index.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. size: {
  12. type: String,
  13. value: 'normal',
  14. },
  15. loading: Boolean,
  16. disabled: Boolean,
  17. plain: Boolean,
  18. type: {
  19. type: String,
  20. value: 'danger',
  21. },
  22. },
  23. methods: {
  24. onClick(event) {
  25. this.$emit('click', event.detail);
  26. this.jumpLink();
  27. },
  28. updateStyle() {
  29. if (this.parent == null) {
  30. return;
  31. }
  32. const { index } = this;
  33. const { children = [] } = this.parent;
  34. this.setData({
  35. isFirst: index === 0,
  36. isLast: index === children.length - 1,
  37. });
  38. },
  39. },
  40. });