emis-app/components/tpx-com-dialog/tpx-com-dialog.vue

102 lines
1.9 KiB
Vue
Raw Normal View History

2023-12-18 16:30:33 +00:00
<template>
<tpx-dialog type="type-dialog" :show="show" :title="title" @onClose="handleCloseModal">
2024-02-01 05:48:20 +00:00
<view style="position: relative;min-height: 260rpx; width: 500rpx;display:flex;flex-direction: column;padding: 0 10rpx 10rpx 10rpx;">
2023-12-18 16:30:33 +00:00
2024-02-01 05:48:20 +00:00
<u-row custom-style="flex: 1;" align="center" justify="center">
2023-12-18 16:30:33 +00:00
<slot name="body">
</slot>
</u-row>
2024-02-02 05:23:24 +00:00
<view class="pd-20 pt-20" >
2023-12-18 16:30:33 +00:00
<u-row justify="between">
2024-09-04 07:26:23 +00:00
<u-button @click="handleBtnCheck('no')"
custom-style="height:70rpx;font-size: 30rpx;width:45%;margin:0;">
2023-12-18 16:30:33 +00:00
{{cancelText}}
</u-button>
2024-09-04 07:26:23 +00:00
<u-button @click="handleBtnCheck('yes')" type="primary"
custom-style="height:70rpx;font-size: 30rpx;width:45%;margin:0;">
2023-12-18 16:30:33 +00:00
{{sureText}}
</u-button>
</u-row>
</view>
</view>
</tpx-dialog>
</template>
<script>
export default {
// computed: {
// filDataList() {
// return []
// },
// },
props: {
title: {
default () {
return ''
}
},
show: {
default () {
return false
}
},
cancelText: {
default () {
return '取消'
}
},
sureText: {
default () {
return '确认'
}
},
},
data() {
return {
2024-06-29 17:19:08 +00:00
curDealPromise: {}
2023-12-18 16:30:33 +00:00
}
},
created() {
},
onHide() {
},
2024-01-30 03:09:14 +00:00
unmounted() {},
2023-12-18 16:30:33 +00:00
methods: {
handleCloseModal() {
this.$emit('update:show', false)
},
handleBtnCheck(type) {
if(type == 'yes') {
this.$emit('onSure')
2024-06-29 17:19:08 +00:00
this.curDealPromise?.resolve?.(true)
2024-09-04 07:21:40 +00:00
this.handleCloseModal()
2023-12-18 16:30:33 +00:00
} else {
this.handleCloseModal()
2024-06-29 17:19:08 +00:00
this.curDealPromise?.resolve?.(false)
2023-12-18 16:30:33 +00:00
this.$emit('onClose')
2024-02-01 05:48:20 +00:00
this.$emit('onCancel')
2023-12-18 16:30:33 +00:00
}
2024-06-29 17:19:08 +00:00
this.curDealPromise = {}
},
getConfirmResult(){
// 显示弹框,并返回promise
this.$emit('update:show', true)
return new Promise((resolve, reject)=> {
this.curDealPromise = {
resolve
}
})
2023-12-18 16:30:33 +00:00
}
}
}
</script>
<style scoped lang="scss">
</style>