index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. customStyle: {
  23. type: String,
  24. value: '',
  25. },
  26. },
  27. methods: {
  28. onClick(event) {
  29. this.$emit('click', event.detail);
  30. this.jumpLink();
  31. },
  32. updateStyle() {
  33. if (this.parent == null) {
  34. return;
  35. }
  36. const {index} = this;
  37. const {children = []} = this.parent;
  38. this.setData({
  39. isFirst: index === 0,
  40. isLast: index === children.length - 1,
  41. });
  42. },
  43. },
  44. });