emis-sapp/components/tpx-com-dialog/tpx-com-dialog.vue
2024-09-04 15:27:02 +08:00

102 lines
1.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<tpx-dialog type="type-dialog" :show="show" :title="title" @onClose="handleCloseModal">
<view style="position: relative;min-height: 260rpx; width: 500rpx;display:flex;flex-direction: column;padding: 0 10rpx 10rpx 10rpx;">
<u-row custom-style="flex: 1;" align="center" justify="center">
<slot name="body">
</slot>
</u-row>
<view class="pd-20 pt-20" >
<u-row justify="between">
<u-button @click="handleBtnCheck('no')"
custom-style="height:70rpx;font-size: 30rpx;width:45%;margin:0;">
{{cancelText}}
</u-button>
<u-button @click="handleBtnCheck('yes')" type="primary"
custom-style="height:70rpx;font-size: 30rpx;width:45%;margin:0;">
{{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 {
curDealPromise: {}
}
},
created() {
},
onHide() {
},
unmounted() {},
methods: {
handleCloseModal() {
this.$emit('update:show', false)
},
handleBtnCheck(type) {
if(type == 'yes') {
this.$emit('onSure')
this.curDealPromise?.resolve?.(true)
this.handleCloseModal()
} else {
this.handleCloseModal()
this.curDealPromise?.resolve?.(false)
this.$emit('onClose')
this.$emit('onCancel')
}
this.curDealPromise = {}
},
getConfirmResult(){
// 显示弹框,并返回promise
this.$emit('update:show', true)
return new Promise((resolve, reject)=> {
this.curDealPromise = {
resolve
}
})
}
}
}
</script>
<style scoped lang="scss">
</style>