<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      簡述

      在此文章中,我將實現一個類似elplus的message組件,代碼十分簡單。

      實現

      我使用的是vnode方式

      • Tip.vue
      <script setup>
      import { onMounted, ref } from 'vue'
      import Icon from '../Icon.vue'
      
      defineProps(['type', 'str', 'withIcon'])
      const visible = ref(false)
      
      onMounted(() => visible.value = true)
      setTimeout(() => visible.value = false, 3000)
      </script>
      
      <template>
        <Transition name="translate">
          <div @click="visible = false" class="pop-message" :class="type" v-show="visible">
            <Icon v-if="withIcon" :icon-name="type"></Icon>
            <span class="text">{{ str }}</span>
          </div>
        </Transition>
      </template>
      
      <style scoped lang="scss">
      .pop-message {
        position: fixed;
        z-index: 9999;
        top: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        gap: 8px;
        border-radius: 2 px;
        left: 50%;
        transform-origin: center center;
        transform: translate(-50%, 0);
        box-shadow: 0px 5px 10px rgba(54, 83, 56, 0.3);
      }
      
      .translate-enter-active,
      .translate-leave-active {
        transition: transform 0.5s ease, opacity 0.5s ease;
      }
      
      .translate-enter-from,
      .translate-leave-to {
        transform: translate(-50%, -30px);
        opacity: 0;
      }
      
      .translate-enter-to,
      .translate-leave-from {
        transform: translate(-50%, 0x);
        opacity: 1;
      }
      
      .text {
        margin: 5px 15px;
      }
      
      .warn {
        color: #e6a23c;
        background-color: #fdf6ec;
      }
      
      .error {
        color: #f56c6c;
        background-color: #fef0f0;
      }
      
      .success {
        color: #64ae40;
        background-color: #fefffd;
      }
      </style>
      
      • Icon.vue
      <!--  -->
      <script setup>
      defineProps(['iconName'])
      </script>
      
      <template>
        <div class="icon" :style="`mask-image:url(/static/svg/${iconName}.svg)`"></div>
      </template>
      
      <style scoped lang="scss">
      .icon {
        mask-repeat: no-repeat;
        mask-position: center;
        display: inline-block;
        width: 15px;
        height: 15px;
        background-color: var(--icon-bgc);
      }
      </style>
      
      
      • index.js
      import { createVNode, render } from 'vue'
      import component from './Tip.vue'
      
      function tip(str, type, withIcon = false) {
      
        const div = document.createElement('div')
        document.body.appendChild(div)
        const vNode = createVNode(component, { type, str, withIcon })
        render(vNode, div)
      
        const timer = setTimeout(() => {
          render(null, div)
          clearTimeout(timer)
        }, 3500)
      }
      
      export default {
        warn: (str, withIcon = false) => tip(str, 'warn', withIcon),
        success: (str, withIcon = false) => tip(str, 'success', withIcon),
        error: (str, withIcon = false) => tip(str, 'error', withIcon)
      }
      

      使用

      import Tip from '@/components/tip'
      
       Tip.success('登錄成功', true)
      
      posted on 2025-02-12 14:50  落寞的雪  閱讀(66)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 综合区一区二区三区狠狠| 国产一区二区三区AV在线无码观看| 女同在线观看亚洲国产精品| 亚洲人成人一区二区三区| 国产精品自拍中文字幕| 精品亚洲国产成人性色av| 日本久久久免费高清| 在国产线视频A在线视频| 国产一区二区三区九九视频 | 亚洲永久一区二区三区在线| 日本人妻巨大乳挤奶水免费| 国产精品中文一区二区| 久久精品国产再热青青青| 色综合久久中文字幕综合网| 91福利一区二区三区| 国产综合内射日韩久| 国产精品美女www爽爽爽视频| 日韩一区在线中文字幕| 欧美色欧美亚洲高清在线视频| 久久一日本综合色鬼综合色| 精品乱人码一区二区二区| 亚洲精品无码高潮喷水在线| 伊人激情一区二区三区av| 亚洲中文久久久精品无码| 日本japanese丰满白浆| 视频二区国产精品职场同事| 4hu四虎永久免费地址ww416| 少妇人妻精品无码专区视频| 色悠悠在线观看入口一区| 依依成人精品视频在线观看| 无翼乌口工全彩无遮挡h全彩| 特级毛片a片久久久久久| 免费AV手机在线观看片| 亚洲人妻系列中文字幕| 亚洲精品一品二品av| 国产一区二区内射最近更新| 亚洲爆乳成av人在线视菜奈实 | 国产99在线 | 亚洲| 一区二区三区精品不卡| 亚洲乱码日产精品一二三| 亚洲欧洲日产国码久在线|