index.js 984 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3. exports.__esModule = true;
  4. exports.default = void 0;
  5. var _vue = _interopRequireDefault(require("vue"));
  6. var _deepAssign = require("../utils/deep-assign");
  7. var _zhCN = _interopRequireDefault(require("./lang/zh-CN"));
  8. var proto = _vue.default.prototype;
  9. var defineReactive = _vue.default.util.defineReactive;
  10. defineReactive(proto, '$vantLang', 'zh-CN');
  11. defineReactive(proto, '$vantMessages', {
  12. 'zh-CN': _zhCN.default
  13. });
  14. var _default = {
  15. messages: function messages() {
  16. return proto.$vantMessages[proto.$vantLang];
  17. },
  18. use: function use(lang, messages) {
  19. var _this$add;
  20. proto.$vantLang = lang;
  21. this.add((_this$add = {}, _this$add[lang] = messages, _this$add));
  22. },
  23. add: function add(messages) {
  24. if (messages === void 0) {
  25. messages = {};
  26. }
  27. (0, _deepAssign.deepAssign)(proto.$vantMessages, messages);
  28. }
  29. };
  30. exports.default = _default;