dingdong-mall/components/modal/confirm-modal.vue

59 lines
1.0 KiB
Vue
Raw Permalink Normal View History

2022-04-23 23:13:29 +08:00
<template>
<view>
<!-- 模态框 -->
<view class="cu-modal" :class="isShow?'show':''">
<view class="cu-dialog">
<view class="padding-xl">
{{content}}
</view>
<view class="cu-bar bg-white">
<view class="action margin-0 flex-sub text-black" @tap="hideModal">{{cancelMsg}}</view>
2022-06-08 18:04:55 +08:00
<view class="action margin-0 flex-sub text-main-color solid-left" @click="confirmCallback">{{confirmMsg}}</view>
2022-04-23 23:13:29 +08:00
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'confirm-modal',
2022-06-08 18:04:55 +08:00
emits: ["confirm", 'cancel'],
2022-04-23 23:13:29 +08:00
props: {
content: {
type: String,
default: ''
},
cancelMsg: {
type: String,
default: '取消'
},
confirmMsg: {
type: String,
default: '确定'
}
},
data() {
return {
isShow: false
}
},
methods: {
showModal(e) {
this.isShow = true
},
hideModal(e) {
2022-06-08 18:04:55 +08:00
this.$emit('cancel');
this.isShow = false;
2022-04-23 23:13:29 +08:00
},
confirmCallback(e) {
2022-06-08 18:04:55 +08:00
this.$emit('confirm');
this.hideModal();
2022-04-23 23:13:29 +08:00
}
}
}
</script>
<style>
</style>