| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <template>
- <uni-popup ref="popupDialog" type="dialog">
- <uni-popup-dialog :class="{'white':!showTitle}" @confirm="DialogConfirm" @close="CloseDialog">
- <view class="dialog_title" v-if="showTitle">
- <view class="dialog_title_lt">
- <image v-if="popType=='alert'" src="@/static/image/icon/icon_warn.png" style="width: 40rpx;height: 40rpx;"></image>
- <text class="title">{{title}}</text>
- </view>
- <image src="@/static/image/icon/close.png" style="width: 48rpx;height: 48rpx;" @click="CloseDialog"></image>
- </view>
- <view class="dialog_content" v-if="popType=='alert'">{{content}}</view>
- <view class="dialog_content" v-else style="height: auto;"><slot></slot></view>
- </uni-popup-dialog>
- </uni-popup>
- </template>
- <script setup>
- import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue';
- import uniPopupDialog from '@/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue';
- import { ref } from 'vue';
- const props = defineProps({
- showTitle:{//是否显示标题
- type:Boolean,
- default:true
- },
- title:{//标题
- type: String,
- default: '提示'
- },
- content:{
- type: String,
- default: ''
- },
- popType:{
- type: String,
- default: 'alert'
- }
- })
- const emit = defineEmits(['DialogConfirm']);
- //删除提示框
- const popupDialog = ref(null);
- //打开弹框
- const OpenDialog = () => {
- popupDialog.value.open();
- }
- //关闭按钮、取消按钮
- const CloseDialog = () => {
- popupDialog.value.close();
- }
- //点击dialog确定按钮触发
- const DialogConfirm = () => {
- emit('DialogConfirm')
- }
- //暴露方法被父组件调用
- defineExpose({
- OpenDialog
- })
- </script>
- <style scoped lang="scss">
-
- </style>
|