优化代码

This commit is contained in:
wuxw 2024-06-25 16:59:03 +08:00
parent 93e768f9d5
commit e784796d4c
2 changed files with 12 additions and 6 deletions

View File

@ -1,11 +1,11 @@
<template name="modal">
<view class="modalInputBg" v-show="modalData.showModal" @tap="modalData.showModal = false">
<view class="modalInputBg" v-show="showModal" >
<view class="modalInput">
<view class="modalDiv" @tap.stop="Bubbling">
<view class="title">{{modalData.title}}</view>
<view class="body"><input type="text" v-model="inputVal" value="" :placeholder="modalData.text"/></view>
<view class="bottom">
<view class="bottomCancel" @tap.stop="modalData.showModal = false">取消</view>
<view class="bottomCancel" @tap.stop="showModal = false">取消</view>
<view class="bottomDefine" @tap.stop="onDefine">确定</view>
</view>
</view>
@ -22,11 +22,15 @@
},
data() {
return {
inputVal: ''
inputVal: '',
showModal:false,
}
},
methods: {
openModal:function(){
this.showModal = true;
},
onDefine(){
if(!this.inputVal){
uni.showToast({
@ -35,7 +39,7 @@
})
return;
}
this.modalData.showModal = false
this.showModal = false
this.$emit('dataInput', this.inputVal);
this.inputVal = ''
},

View File

@ -65,7 +65,7 @@
<view v-else>
<no-data-page></no-data-page>
</view>
<myModal :modalData='modal' @dataInput='dataInput'></myModal>
<myModal ref="myModalRef" :modalData='modal' @dataInput='dataInput'></myModal>
</view>
</template>
@ -282,7 +282,9 @@
stopRepair(item){
this.actItem = item;
this.modal.showModal = true
//this.modal.showModal = true
this.$refs.myModalRef.openModal();
},
// input