| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import { getDecimalNum } from "../../utils/util";
- // components/num-range/num-range.ts
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- /// 单位
- unit: {
- type: String,
- value: 'CT'
- },
- min: {
- type: String,
- value: '0.00'
- },
- max: {
- type: String,
- value: '0.00'
- }
- },
- /**
- * 组件的初始数据
- */
- data: {},
- /**
- * 组件的方法列表
- */
- methods: {
- /**
- * 输入框变化
- */
- valueInput(e: any) {
- /// 截取2位小数位
- let num = getDecimalNum(e.detail.value)
- switch (e.target.id) {
- case 'min':
- this.setData({ min: num })
- break;
- default:
- this.setData({ max: num })
- break;
- }
- this.triggerEvent('sync', { value: [this.properties.min, this.properties.max] })
- }
- },
- observers: {}
- })
|