1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關咨詢
      選擇下列產品馬上在線溝通
      服務時間:8:30-17:00
      你可能遇到了下面的問題
      關閉右側工具欄

      新聞中心

      這里有您想知道的互聯(lián)網營銷解決方案
      vue-cli項目中如何使用公用的提示彈層tips或加載loading組件

      小編給大家分享一下vue-cli項目中如何使用公用的提示彈層tips或加載loading組件,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!

      創(chuàng)新互聯(lián)公司主營廬陽網站建設的網絡公司,主營網站建設方案,重慶App定制開發(fā),廬陽h5微信平臺小程序開發(fā)搭建,廬陽網站營銷推廣歡迎廬陽等地區(qū)企業(yè)咨詢

      項目結構,在組件文件夾(components)下新建common文件夾,所用公用組件放里面,本例包含tips和loading兩個

      vue-cli項目中如何使用公用的提示彈層tips或加載loading組件

      一、loading組件

          1.loading.vue組件內容如下:

      vue-cli項目中如何使用公用的提示彈層tips或加載loading組件

      代碼:

       
       
       
        .loading{
        display: flex;
        justify-content: center;
        flex-direction: column;
        align-items: center;
        position: fixed;
        left: 0;
        top: 0;
        z-index: 999;
        width: 100 %;
        height: 100 %;
        color: #fff;
        background - color: rgba(0, 0, 0, 0.8);
        p {
         padding: .15rem .15rem .2rem;
         color: #fff;
         font-size: .16rem;
        }
        img {
         width: .4rem;
         height: .4rem;
        }
        }
       

      2.app.vue中設置

      vue-cli項目中如何使用公用的提示彈層tips或加載loading組件

      
      

      在main.js中設置

      vue-cli項目中如何使用公用的提示彈層tips或加載loading組件

      Vue.prototype.bus = new Vue;

      3.在.vue組件中使用    

      // 顯示loading
      this.bus.$emit('loading', true);
      // 關閉loading
      this.bus.$emit('loading', false);

      效果如下

      vue-cli項目中如何使用公用的提示彈層tips或加載loading組件

      二、tips組件

      1.內容:

      vue-cli項目中如何使用公用的提示彈層tips或加載loading組件

      代碼:

      
      
      
      .tips{
       display: flex;
       justify-content: center;
       flex-direction: column;
       align-items: center;
       position: fixed;
       left: 0;
       top: 0;
       z-index: 999;
       width: 100%;
       height: 100%;
       color: #fff;
       h4{
       padding: .1rem .2rem;
       font-size: 12px;
       line-height: 12px;
       background-color: rgba(0,0,0,0.8);
       border-radius: 4px;
       }
      }
      

      2.app.vue中設置

      vue-cli項目中如何使用公用的提示彈層tips或加載loading組件

      在main.js中設置

      vue-cli項目中如何使用公用的提示彈層tips或加載loading組件

      Vue.prototype.bus = new Vue;

      3.在.vue組件中使用

      this.bus.$emit('tips', { show: true, title: '我是標題'})

      效果:

      vue-cli項目中如何使用公用的提示彈層tips或加載loading組件

      看完了這篇文章,相信你對“vue-cli項目中如何使用公用的提示彈層tips或加載loading組件”有了一定的了解,如果想了解更多相關知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!


      文章題目:vue-cli項目中如何使用公用的提示彈層tips或加載loading組件
      當前網址:http://www.ef60e0e.cn/article/ighppj.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        阜康市| 广饶县| 泸西县| 个旧市| 中山市| 海宁市| 宕昌县| 西乌珠穆沁旗| 漳浦县| 衡东县| 杭州市| 林西县| 禄丰县| 黔南| 灵川县| 景宁| 常熟市| 宜城市| 绥棱县| 东阿县| 虹口区| 冕宁县| 兴义市| 方城县| 溧阳市| 新郑市| 濉溪县| 镇坪县| 徐汇区| 阳春市| 政和县| 双鸭山市| 咸阳市| 清镇市| 津市市| 高邑县| 青川县| 故城县| 宁强县| 偃师市| 韶关市|