提交 23ff799c 编写于 作者: H HRK

新增 uni-number-box 设置宽度属性(单位:px)

上级 31958e68
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
|max|Number |100|最大值| |max|Number |100|最大值|
|step|Number|1|每次点击改变的间隔大小| |step|Number|1|每次点击改变的间隔大小|
|disabled|Boolean|false |是否为禁用状态| |disabled|Boolean|false |是否为禁用状态|
|width|Number|40 |宽度(单位:px)|
### NumberBox Events ### NumberBox Events
...@@ -51,63 +52,63 @@ ...@@ -51,63 +52,63 @@
::: preview https://hellouniapp.dcloud.net.cn/pages/extUI/number-box/number-box ::: preview https://hellouniapp.dcloud.net.cn/pages/extUI/number-box/number-box
> Template > Template
``` html ``` html
<template> <template>
<view class="page"> <view class="page">
<uni-card :is-shadow="false" is-full> <uni-card :is-shadow="false" is-full>
<text class="uni-h6">数字输入框组件多用于购物车加减商品等场景</text> <text class="uni-h6">数字输入框组件多用于购物车加减商品等场景</text>
</uni-card> </uni-card>
<uni-section title="基本用法" type="line" padding> <uni-section title="基本用法" type="line" padding>
<uni-number-box @change="changeValue" /> <uni-number-box @change="changeValue" />
</uni-section> </uni-section>
<uni-section :title="'使用v-model : '+ vModelValue" subTitle="使用 v-model 显示默认值" type="line" padding> <uni-section :title="'使用v-model : '+ vModelValue" subTitle="使用 v-model 显示默认值" type="line" padding>
<uni-number-box v-model="vModelValue" @blur="blur" @focus="focus" @change="changeValue" /> <uni-number-box v-model="vModelValue" @blur="blur" @focus="focus" @change="changeValue" />
</uni-section> </uni-section>
<uni-section title="设置最小值和最大值" subTitle="使用 min \ max 属性设置最大最小值" type="line" padding> <uni-section title="设置最小值和最大值" subTitle="使用 min \ max 属性设置最大最小值" type="line" padding>
<uni-number-box :min="2" :max="9" :value="555" /> <uni-number-box :min="2" :max="9" :value="555" />
</uni-section> </uni-section>
<uni-section title="设置步长(步长0.1)" subTitle="使用 step 属性设置步长" type="line" padding> <uni-section title="设置步长(步长0.1)" subTitle="使用 step 属性设置步长" type="line" padding>
<uni-number-box :value="1.1" :step="0.1" /> <uni-number-box :value="1.1" :step="0.1" />
</uni-section> </uni-section>
<uni-section title="自定义背景" type="line" subTitle="使用 background 属性设置自定义背景色" padding> <uni-section title="自定义背景" type="line" subTitle="使用 background 属性设置自定义背景色" padding>
<uni-number-box :value="50" background="#2979FF" color="#fff" /> <uni-number-box :value="50" background="#2979FF" color="#fff" />
</uni-section> </uni-section>
<uni-section title="禁用状态" subTitle="使用 disabled 属性设置组件禁用" type="line" padding> <uni-section title="禁用状态" subTitle="使用 disabled 属性设置组件禁用" type="line" padding>
<uni-number-box :disabled="true" /> <uni-number-box :disabled="true" />
</uni-section> </uni-section>
<uni-section :title="'获取输入的值 : '+ numberValue" type="line" padding> <uni-section :title="'获取输入的值 : '+ numberValue" type="line" padding>
<uni-number-box :value="numberValue" @change="change" /> <uni-number-box :value="numberValue" @change="change" />
</uni-section> </uni-section>
</view> </view>
</template> </template>
``` ```
> Script > Script
``` html ``` html
<script> <script>
export default { export default {
components: {}, components: {},
data() { data() {
return { return {
numberValue: 0, numberValue: 0,
vModelValue: 3 vModelValue: 3
} }
}, },
methods: { methods: {
change(value) { change(value) {
this.numberValue = value this.numberValue = value
}, },
changeValue(value) { changeValue(value) {
console.log('返回数值:', value); console.log('返回数值:', value);
}, },
blur(e) { blur(e) {
console.log('blur:', e); console.log('blur:', e);
}, },
focus(e) { focus(e) {
console.log('focus:', e); console.log('focus:', e);
} }
} }
} }
</script> </script>
``` ```
::: :::
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册