index.js 939 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { VantComponent } from '../common/component';
  2. import { link } from '../mixins/link';
  3. import { button } from '../mixins/button';
  4. import { openType } from '../mixins/open-type';
  5. VantComponent({
  6. mixins: [link, button, openType],
  7. relation: {
  8. type: 'ancestor',
  9. name: 'goods-action',
  10. current: 'goods-action-button',
  11. },
  12. props: {
  13. text: String,
  14. color: String,
  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 { children = [] } = this.parent;
  33. const { length } = children;
  34. const index = children.indexOf(this);
  35. this.setData({
  36. isFirst: index === 0,
  37. isLast: index === length - 1,
  38. });
  39. },
  40. },
  41. });