Commit ab15a158 authored by 刘用法's avatar 刘用法

材料页面-点击清空失去焦点如果没输入用原先的值

parent 5633249e
......@@ -13,7 +13,7 @@
<view class="line-view"></view>
<u-tr class="u-tr" v-for="(item, index) in list" :key="index">
<u-td class="u-td" v-for="(value, key) in titles" :key="key">
<u-input v-if="key == 'useLength'" type="digit" placeholder="0" v-model="item[key]" placeholder-style="color: #999999;font-size:26rpx" input-align="center" :clearable="false"><u-icon name="edit"></u-icon></u-input>
<u-input v-if="key == 'useLength'" @blur="handleBlur(item)" @focus="handleFocus(item)" type="digit" :placeholder="null" v-model="item[key]" placeholder-style="color: #999999;font-size:26rpx" input-align="center" :clearable="false"><u-icon name="edit"></u-icon></u-input>
<text v-else :class="['tab-th-txt', {'left': key == firstKey}]">{{item[key]}}</text>
</u-td>
</u-tr>
......@@ -139,13 +139,15 @@
self.formatServiceMoreList(data)
}
});
/*
// 测试数据
// var item = {matName: '碳纤维',
// matUnit: '米',
// freeLength: 4,
// unitAmt: '2',
// useLength: 6}
// this.list = [{...item}, {...item}, {...item}, {...item}]
var item = {matName: '碳纤维',
matUnit: '米',
freeLength: 4,
unitAmt: '2',
useLength: 6}
this.list = [{...item}, {...item}, {...item}, {...item}]
*/
},
created() {
},
......@@ -172,6 +174,16 @@
}
})
},
handleBlur(item) { // 失去焦点如果没输入用原先的值
if (!item.useLength) {
item.useLength = item.temp
}
},
handleFocus(item) { // 点击清空
item.temp = item.useLength;
item.useLength = ''
},
/* 其他添加新的 */
handleAdd() {
this.other.push({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment