index.js 883 B

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