import { Button, Popup } from 'vant'; import { PropType, defineComponent, onMounted, ref, watch } from 'vue'; import styles from './index.module.less'; import { browser } from '@/helpers/utils'; export default defineComponent({ name: 'm-wx-tip', props: { // 是否显示微信弹窗 show: { type: Boolean, default: true }, title: { type: String, default: '温馨提示' }, message: { type: String, default: '请使用微信打开' }, messageAlign: { type: String as PropType<'center' | 'left' | 'right'>, default: 'center' }, /** 是否展示取消按钮 */ showCancelButton: { type: Boolean, default: false }, /** 取消按钮文案 */ cancelButtonText: { type: String, default: '取消' }, /** 取消按钮颜色 */ cancelButtonColor: { type: String, default: '' }, /** 是否展示确认按钮 */ showConfirmButton: { type: Boolean, default: true }, /** 确认按钮文案 */ confirmButtonText: { type: String, default: '确认' }, /** 确认按钮颜色 */ confirmButtonColor: { type: String, default: '' }, /** 是否有关闭按钮 */ showCloseButton: { type: Boolean, default: true } }, emits: ['confirm', 'cancel', 'close'], setup(props, { emit }) { const showPopup = ref(false); onMounted(() => { if (props.show) { showPopup.value = true; } }); watch( () => [props.show, props.message], () => { if (props.show) { showPopup.value = true; } else { showPopup.value = false; } } ); return () => ( <>
{props.showCloseButton && ( emit('close')}> )}

{(props.showConfirmButton || props.showConfirmButton) && (
{props.showCancelButton && ( )} {props.showConfirmButton && ( )}
)}
); } });