index.js 1010 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = void 0;
  4. var _utils = require("../utils");
  5. var _relation = require("../mixins/relation");
  6. var _createNamespace = (0, _utils.createNamespace)('sidebar'),
  7. createComponent = _createNamespace[0],
  8. bem = _createNamespace[1];
  9. var _default = createComponent({
  10. mixins: [(0, _relation.ParentMixin)('vanSidebar')],
  11. model: {
  12. prop: 'activeKey'
  13. },
  14. props: {
  15. activeKey: {
  16. type: [Number, String],
  17. default: 0
  18. }
  19. },
  20. data: function data() {
  21. return {
  22. index: +this.activeKey
  23. };
  24. },
  25. watch: {
  26. activeKey: function activeKey() {
  27. this.setIndex(+this.activeKey);
  28. }
  29. },
  30. methods: {
  31. setIndex: function setIndex(index) {
  32. if (index !== this.index) {
  33. this.index = index;
  34. this.$emit('change', index);
  35. }
  36. }
  37. },
  38. render: function render() {
  39. var h = arguments[0];
  40. return h("div", {
  41. "class": bem()
  42. }, [this.slots()]);
  43. }
  44. });
  45. exports.default = _default;