12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <template>
- <view class="main">
- <uni-icons type="minus-filled" size="20" color="#A67A54" @click="numReduce"></uni-icons>
- <!-- <text class="buy-select">{{number}}</text> -->
- <u-input
- v-model="number"
- type="number"
- height="40"
- :placeholder="placeholder"
- :clearable="false"
- :disabled="isDisabled"
- input-align="center"
- :custom-style="{width:'45px'}"/>
- <uni-icons type="plus-filled" size="20" color="#A67A54" @click="numPlus"></uni-icons>
- </view>
- </template>
- <script>
- export default {
- props: {
- isDisabled: {
- default: false
- },
- placeholder: {
- default: ''
- },
- step: {
- default: 1
- },
- minNum: {
- default: 0.01
- }
- },
- data() {
- return {
- number: 1,
- }
- },
- methods: {
- numPlus() {
- this.number = this.number + this.step
- this.$emit('getNum',this.number);
- },
- numReduce() {
- if ((this.number - this.step) >= this.minNum) {
- this.number = this.number - this.step
- }
- this.$emit('getNum',this.number);
- }
- }
- }
- </script>
- <style>
- </style>
- <style lang="less" scoped>
- .main {
- display: flex;
- align-items: center;
- }
- </style>
|