emis-app/components/buns-edit-sheet/buns-edit-sheet.vue

127 lines
2.2 KiB
Vue
Raw Normal View History

2023-12-18 16:30:33 +00:00
<template>
2024-12-05 15:21:25 +00:00
<tpx-dialog :show="show" :title="title" @onClose="handleCloseModal()" rootStyle="min-height:auto;"
:contentStyle="contentStyle"
>
2024-06-11 03:25:41 +00:00
<view :style="cptStyle">
2023-12-18 16:30:33 +00:00
<tpx-layout>
<template v-slot:body>
2024-12-05 15:21:25 +00:00
<view v-if="contShow" class="pl-30 pr-30">
<slot :value="submitVals"></slot>
</view>
2023-12-18 16:30:33 +00:00
</template>
<template v-slot:footer>
<view class="blcok-white-noradius" style="margin-top: 0;margin-bottom: 0;">
<u-button @click="handleSubmitValue()" type="primary" size="large" shape="circle"
custom-style="height:80rpx;font-size: 30rpx;"
>确认</u-button>
</view>
</template>
</tpx-layout>
</view>
</tpx-dialog>
</template>
<script>
2024-01-30 07:40:49 +00:00
2023-12-18 16:30:33 +00:00
export default {
2024-06-11 03:25:41 +00:00
computed:{
cptStyle(){
let sty = `position: relative;height: calc(${this.percentHeight}vh);`
return sty
}
},
2024-01-30 07:40:49 +00:00
components: { },
2024-01-29 06:07:42 +00:00
watch: {
2024-01-29 07:03:57 +00:00
show(v){
if(v) {
this.submitVals = JSON.parse(JSON.stringify(this.value))
}
2024-12-05 15:21:25 +00:00
setTimeout(()=> {
// 防止 弹框内容组件不更新、有缓存
this.contShow = v
}, 350)
2024-01-29 06:07:42 +00:00
}
},
2023-12-18 16:30:33 +00:00
props: {
2024-01-30 07:40:49 +00:00
title: {
default () {
return ''
}
},
2024-12-05 15:21:25 +00:00
contentStyle: {
default () {
return 'padding:0;'
}
},
2024-01-30 07:40:49 +00:00
percentHeight: {
default () {
return 60
}
},
2023-12-18 16:30:33 +00:00
show: {
default () {
return false
}
},
value: {
default () {
2024-01-29 06:07:42 +00:00
return {
}
2023-12-18 16:30:33 +00:00
}
2024-06-13 08:06:13 +00:00
},
okCloseModal: {
default () {
return true
}
},
2024-12-22 03:35:17 +00:00
sureCheckFun: {
default () {
return null
}
},
2023-12-18 16:30:33 +00:00
},
data() {
return {
2024-12-05 15:21:25 +00:00
contShow: false,
2024-01-29 06:07:42 +00:00
submitVals: {}
2023-12-18 16:30:33 +00:00
}
},
created() {
},
onHide() {
},
2024-01-29 06:07:42 +00:00
unmounted() {
},
2023-12-18 16:30:33 +00:00
methods: {
handleCloseModal() {
this.$emit('update:show', false)
2024-03-04 11:09:51 +00:00
this.$emit('onClose')
2023-12-18 16:30:33 +00:00
},
2024-12-22 03:35:17 +00:00
async handleSubmitValue() {
2024-01-29 06:07:42 +00:00
const val = this.submitVals
2024-12-22 03:35:17 +00:00
if(this.sureCheckFun) {
let bl = await this.sureCheckFun(val)
if(!bl){
return false
}
}
2024-01-29 06:07:42 +00:00
this.$emit('onSure', val)
this.$emit('update:value', val)
2024-06-13 08:06:13 +00:00
this.okCloseModal && this.handleCloseModal()
2023-12-18 16:30:33 +00:00
}
}
}
</script>
<style scoped lang="scss">
.shet-cont{
padding: 10rpx 0 30rpx 0;
}
.jsfm-item{
margin-top: 30rpx;
}
</style>