index.js
1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { VantComponent } from '../common/component';
import { safeArea } from '../mixins/safe-area';
VantComponent({
mixins: [safeArea()],
classes: [
'bar-class',
'price-class',
'button-class'
],
props: {
tip: null,
type: Number,
price: null,
label: String,
loading: Boolean,
disabled: Boolean,
buttonText: String,
currency: {
type: String,
value: '¥'
},
buttonType: {
type: String,
value: 'danger'
}
},
computed: {
hasPrice() {
return typeof this.data.price === 'number';
},
priceStr() {
return (this.data.price / 100).toFixed(2);
},
tipStr() {
const { tip } = this.data;
return typeof tip === 'string' ? tip : '';
}
},
methods: {
onSubmit(event) {
this.$emit('submit', event.detail);
}
}
});