index.js 815 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { use } from '../utils';
  2. var _use = use('collapse'),
  3. sfc = _use[0],
  4. bem = _use[1];
  5. export default sfc({
  6. props: {
  7. accordion: Boolean,
  8. value: [String, Number, Array],
  9. border: {
  10. type: Boolean,
  11. "default": true
  12. }
  13. },
  14. data: function data() {
  15. return {
  16. items: []
  17. };
  18. },
  19. methods: {
  20. "switch": function _switch(name, expanded) {
  21. if (!this.accordion) {
  22. name = expanded ? this.value.concat(name) : this.value.filter(function (activeName) {
  23. return activeName !== name;
  24. });
  25. }
  26. this.$emit('change', name);
  27. this.$emit('input', name);
  28. }
  29. },
  30. render: function render(h) {
  31. return h("div", {
  32. "class": [bem(), {
  33. 'van-hairline--top-bottom': this.border
  34. }]
  35. }, [this.slots()]);
  36. }
  37. });