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://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>

        湖州市| 来凤县| 那坡县| 寿宁县| 安远县| 阿图什市| 彰化市| 邻水| 铁力市| 瑞丽市| 四会市| 石柱| 东乌珠穆沁旗| 乃东县| 什邡市| 常熟市| 吉水县| 曲水县| 监利县| 北川| 曲水县| 弥渡县| 马龙县| 县级市| 连南| 甘谷县| 恩平市| 诸暨市| 资兴市| 巩留县| 泸溪县| 浠水县| 蕉岭县| 海盐县| 贵溪市| 河南省| 登封市| 双江| 保定市| 衡南县| 湘西|