1
admin
2026-01-13 95e138158db3e61e0be67691a4142f20c561634c
src/components/elalert.vue
@@ -1,10 +1,11 @@
<!--  -->
<template>
    <div v-if="$store.state.elAlertShow">
        <el-alert  :closable="closable" :title="$store.state.elAlertText" :type="$store.state.elAlertType" center style="z-index:99999999999999999;position: fixed;top: 0;bottom: 0;margin: auto;">
    </el-alert>
        <el-alert :closable="closable" :title="$store.state.elAlertText" :type="$store.state.elAlertType" center
            style="z-index:99999999999999999;position: fixed;top: 0;bottom: 0;margin: auto;">
        </el-alert>
    </div>
</template>
<script>
@@ -38,28 +39,28 @@
        '$store.state.elAlertShow': function (val) {
            if (val) {
                setTimeout(() => {
            this.$store.commit('elAlertShow', {'elAlertShow':false});
                    this.$store.commit('elAlertShow', { 'elAlertShow': false });
                }, 2000)
            }
        }
    },
    //生命周期 - 创建完成(访问当前this实例)
    created() {
    },
    //生命周期 - 挂载完成(访问DOM元素)
    mounted() {
    },
    methods:{
    methods: {
        //定时调用父组件方法关闭弹窗
        closeAlert(){
        closeAlert() {
            //定时调用父组件方法关闭弹窗
            setTimeout(()=>{
            setTimeout(() => {
                this.$emit('closeAlert')
            },2000)
            }, 2000)
        },
    }
}
</script>