import { Icon } from 'vant' import { defineComponent, onMounted, ref } from 'vue' import styles from './index.module.less' import icon3 from '../../images/icon3.png' export default defineComponent({ name: 'tips', props: { /** 标题 */ title: { type: String, default: '', }, /** 内容 */ content: { type: String, default: '' }, /** 类型 */ type: { type: String, default: '' }, btnTxt: { type: String, default: '不再提醒' } }, emits: ['close', 'confirm'], setup(props, { emit }) { const isStatus = ref(true) console.log(props.type, '1212') // 获取当前提示是否有缓存 const getTypeIsCatch = () => { const localType = localStorage.getItem('teacher_home_local'); const formatLocalType = localType ? JSON.parse(localType) : {} console.log(formatLocalType[props.type]) if(formatLocalType[props.type]) { return true } else { return false } } // 设置已知道 const setTypeIsCatch = () => { const localType = localStorage.getItem('teacher_home_local'); const formatLocalType = localType ? JSON.parse(localType) : {} formatLocalType[props.type] = 1 localStorage.setItem('teacher_home_local', JSON.stringify(formatLocalType)) } onMounted(() => { isStatus.value = !getTypeIsCatch() }) return () => ( isStatus.value ?
{ emit('close') isStatus.value = false }} name="cross" />
{props.title}
{props.content}
{ emit("confirm") setTypeIsCatch() isStatus.value = false }}>{props.btnTxt}
: '' ) } })