[Improvement] SubmitBar: upgrade style (#1631)

This commit is contained in:
neverland
2018-08-14 20:00:05 +08:00
committed by GitHub
parent 225bdaef01
commit b24e21b9cb
6 changed files with 21 additions and 24 deletions

View File

@@ -1,15 +1,15 @@
<template>
<div :class="b()">
<slot name="top" />
<div :class="b('tip')" v-if="tip || $slots.tip">
{{ tip }}<slot name="tip" />
</div>
<div :class="b('bar')">
<slot />
<div :class="b('price')">
<div :class="b('text')">
<template v-if="hasPrice">
<span>{{ label || $t('label') }}</span>
<span :class="b('price-integer')">{{ currency }}{{ priceInterger }}.</span>
<span :class="b('price-decimal')">{{ priceDecimal }}</span>
<span :class="b('price')">{{ currency }} {{ price | format }}</span>
</template>
</div>
<van-button :type="buttonType" :disabled="disabled" :loading="loading" @click="$emit('submit')">
@@ -51,13 +51,12 @@ export default create({
computed: {
hasPrice() {
return typeof this.price === 'number';
},
priceInterger() {
return Math.floor(this.price / 100);
},
priceDecimal() {
const decimal = Math.floor(this.price % 100);
return (decimal < 10 ? '0' : '') + decimal;
}
},
filters: {
format(price) {
return (price / 100).toFixed(2);
}
}
});