index.js 965 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { VantComponent } from '../common/component';
  2. import { useParent } from '../common/relation';
  3. import { button } from '../mixins/button';
  4. import { link } from '../mixins/link';
  5. VantComponent({
  6. mixins: [link, button],
  7. relation: useParent('goods-action'),
  8. props: {
  9. text: String,
  10. color: String,
  11. loading: Boolean,
  12. disabled: Boolean,
  13. plain: Boolean,
  14. type: {
  15. type: String,
  16. value: 'danger',
  17. },
  18. },
  19. methods: {
  20. onClick(event) {
  21. this.$emit('click', event.detail);
  22. this.jumpLink();
  23. },
  24. updateStyle() {
  25. if (this.parent == null) {
  26. return;
  27. }
  28. const { index } = this;
  29. const { children = [] } = this.parent;
  30. this.setData({
  31. isFirst: index === 0,
  32. isLast: index === children.length - 1,
  33. });
  34. },
  35. },
  36. });