import { Button, Popup } from 'vant'; import { 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: '请使用微信打开' }, showButton: { type: Boolean, default: false }, buttonText: { type: String, default: '确定' } }, emits: ['confirm'], setup(props, { emit }) { const showPopup = ref(false); onMounted(() => { if (!browser().weixin && props.show) { showPopup.value = true; return; } }); watch( () => [props.show, props.message], () => { if (props.show) { showPopup.value = true; } else { showPopup.value = false; } } ); return () => ( <>

{props.title}

{props.message}

{props.showButton && ( )}
); } });