index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 _constant = require("../utils/constant");
  7. var _createNamespace = (0, _utils.createNamespace)('collapse'),
  8. createComponent = _createNamespace[0],
  9. bem = _createNamespace[1];
  10. var _default = createComponent({
  11. mixins: [(0, _relation.ParentMixin)('vanCollapse')],
  12. props: {
  13. accordion: Boolean,
  14. value: [String, Number, Array],
  15. border: {
  16. type: Boolean,
  17. default: true
  18. }
  19. },
  20. methods: {
  21. switch: function _switch(name, expanded) {
  22. if (!this.accordion) {
  23. name = expanded ? this.value.concat(name) : this.value.filter(function (activeName) {
  24. return activeName !== name;
  25. });
  26. }
  27. this.$emit('change', name);
  28. this.$emit('input', name);
  29. }
  30. },
  31. render: function render() {
  32. var _ref;
  33. var h = arguments[0];
  34. return h("div", {
  35. "class": [bem(), (_ref = {}, _ref[_constant.BORDER_TOP_BOTTOM] = this.border, _ref)]
  36. }, [this.slots()]);
  37. }
  38. });
  39. exports.default = _default;