neverland 493371c7a1
[Improvement] SubmitBar: add left slot (#345)
* fix: Tabbar icon line-height

* [new feature] progress add showPivot prop

* [new feature] TabItem support vue-router

* [new feature] update document header style

* [Doc] add toast english ducoment

* [bugfix] Search box-sizing wrong

* [Doc] update vant-demo respo

* [Doc] translate theme & demo pages

* [Doc] add Internationalization document

* [bugfix] remove unnecessary props

* [fix] optimize clickoutside

* [new feature] optimize find-parent

* [new feature]: change document title accordinng to language

* [new feature] Pagination code review

* [improvement] adjust icon-font unicode

* [improvement] Icon spinner color inherit

* [improvement] icon default width

* [bugfix] DateTimePicker validate date props

* [bugfix] Tab item text ellipsis

* [improvement] optimize single line ellipsis

* [Improvement] optimzie staticClass

* [Improvement] Button: use sfc instread of jsx

* [Improvement] update actionsheet close icon style

* fix: yarn.lock

* fix: icon test cases

* [bugfix] errors during ssr

* [Improvement] SubmitBar add left slot
2017-11-23 20:23:42 +08:00

67 lines
1.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="van-submit-bar">
<div class="van-submit-bar__tip" v-show="tip || $slots.tip">
{{ tip }}<slot name="tip" />
</div>
<div class="van-submit-bar__bar">
<slot />
<div class="van-submit-bar__price">
<template v-if="hasPrice">
<span class="van-submit-bar__price-text">合计</span>
<span class="van-submit-bar__price-interger">¥{{ priceInterger }}.</span>
<span class="van-submit-bar__price-decimal">{{ priceDecimal }}</span>
</template>
</div>
<van-button :type="buttonType" :disabled="disabled" :loading="loading" @click="onSubmit">
{{ loading ? '' : buttonText }}
</van-button>
</div>
</div>
</template>
<script>
import Button from '../button';
export default {
name: 'van-submit-bar',
components: {
[Button.name]: Button
},
props: {
tip: String,
type: Number,
price: Number,
loading: Boolean,
disabled: Boolean,
buttonText: String,
buttonType: {
type: String,
default: 'danger'
}
},
computed: {
hasPrice() {
return typeof this.price === 'number';
},
priceInterger() {
return Math.floor(this.price / 100);
},
priceDecimal() {
const decimal = this.price % 100;
return (decimal < 10 ? '0' : '') + decimal;
}
},
methods: {
onSubmit() {
if (!this.disabled && !this.loading) {
this.$emit('submit');
}
}
}
};
</script>