Sanakey
2021-01-31 53cc6f817625897935fb10c3845ad7be400f3036
提交 | 用户 | age
d98d05 1 import { VantComponent } from '../common/component';
53cc6f 2 import { useParent } from '../common/relation';
d98d05 3 import { button } from '../mixins/button';
53cc6f 4 import { link } from '../mixins/link';
d98d05 5 import { openType } from '../mixins/open-type';
S 6 VantComponent({
7   mixins: [link, button, openType],
53cc6f 8   relation: useParent('goods-action'),
d98d05 9   props: {
S 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       }
53cc6f 29       const { index } = this;
d98d05 30       const { children = [] } = this.parent;
S 31       this.setData({
32         isFirst: index === 0,
53cc6f 33         isLast: index === children.length - 1,
d98d05 34       });
S 35     },
36   },
37 });