vue this.$refs 动态拼接

业务需要,refs是不固定的

<vxe-grid ref='gridWarehouse' v-bind="gridWarehouseOptions" v-if="tableHeight" :height="tableHeight"
       :expand-config="{iconOpen: 'vxe-icon-square-minus', iconClose: 'vxe-icon-square-plus'}"
        @checkbox-change
``` <template> <view> <view class="sys-head"> <view class="sys-head-query"> <bus-input ref="childInputOne" :lblTitleP="'SN'" :focusP="true" @inputCallBackEmit="inputCallBackEmitOne"> </bus-input> </view> <view> <view v-for="(item,index) in snlist" :key="item,index" class="sys-body-content-list sys-border"> <view class="sys-body-content-list-left"> <view class="sys-body-content-list-left_ft"> <label class="sys-left-lab">SN:</label> <label>{{item.sn}}</label> </view> </view> <view class="sys-body-content-list-right"> <div class="sys-right-lab"> <image src="../../static/img/application/delete.png" style="height: 50rpx;width: 50rpx;" mode="aspectFit" @tap="deleteItem(index)"></image> </div> </view> </view> </view> </view> <view class="sys-body body"> <view> <label v-for="(item, index) in contentList" :key="item.index"> <view class="sys-body-content-list sys-border"> <view class="sys-body-content-list-left"> <view> <label class="sys-list-ey">SN{{[contentList.length-index]}}:</label> <label>{{item.part}}</label> </view> </view> <view class="sys-body-content-list-right"> <div class="sys-right-lab"> <image src="../../static/img/application/delete.png" style="height: 50rpx;width: 50rpx;" mode="aspectFit" @tap="deleteItem(index)"></image> </div> </view> </view> </label> </view> </view> <view class="sys-footer u-f u-f-aic"> <u-button class="sys-button" type="primary" @tap="save">提交</u-button> </view> </view> </template> <script> export default { data() { return { //搜索框订单号 parameterOne: "", //请求参数 params: { shipmentId: "", code: "" }, //出库单号 shipmentCode: null, //返回数据对象集合 contentList: [], snlist: [] } }, //界面加载完成执行 onLoad(option) { console.log(option) this.params.shipmentId = option.id; // if (option.snlist !== "" || option.snlist !== null) { // const ww = option.snlist.split(',') // cons.log(ww) // // if(ww.length){ // // snlist.push(option.snlist) // // } // } //this.$config.setAppTitle(this.$mp.page.route); }, methods: { inputCallBackEmitOne(val) { this.parameterOne = val; if (val != "") { this.getData() } this.$refs.childInputOne.setInputFocus(); }, //删除 deleteItem(index) { this.contentList.splice(index, 1); }, getData() { if (this.contentList.length >= 8) { this.$wx.showToast({ title: `最多只能绑定8条SN!` }); return } var result = { part: this.parameterOne, } const hasCommonValue = this.contentList.some(item => item.part === result.part); if (hasCommonValue) { this.parameterOne = ""; this.$refs.childInputOne.cleanInputVal(); this.$refs.childInputOne.setInputFocus(); this.$wx.showToast({ title: `已绑定相同的部件编码【${result.part}】!` }); } else { this.contentList.unshift(result); this.parameterOne = ""; this.$refs.childInputOne.cleanInputVal(); this.$refs.childInputOne.setInputFocus(); } }, save() { var snlistdata = this.contentList.map(item => item.part).join(','); let data = { shipmentDetailId: this.params.shipmentId, snlist: snlistdata, } this.$api.out.shipmentBindSn(data).then(res => { if (res.data.code == 200) { this.$wx.showToast({ title: '业务数据操作成功!' }); this.clearVal() } }) }, clearVal() { this.parameterOne = ""; this.$refs.childInputOne.cleanInputVal(); this.$refs.childInputOne.setInputFocus(); this.contentList = [] } } } </script> <style lang="scss" scoped> .body { //【根据实际情况修改】 padding-bottom: 10rpx; //【根据实际情况修改】 margin-top: 100rpx; } .sys-body-content-list-left_ft { font-size: 38rpx; } </style>```根据snlist渲染到表格
03-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值