zoukankan      html  css  js  c++  java
  • vue-cli快速搭建项目的几个文件(三)

    ==========有加载动画的app.vue===========
    <template>
      <div id="app">
        <keep-alive>
          <router-view v-if="$route.meta.keepAlive"></router-view>
        </keep-alive>
        <van-loading type="spinner" v-show="LOADING" color="#1989fa" class='loading posiAbsol' />
        <router-view v-if="!$route.meta.keepAlive"></router-view>
      </div>
    </template>

    <script>
    import {mapState} from 'vuex'
    export default {
      name: 'App',
      computed:{
          ...mapState([
              'LOADING'
          ])
      },
      components: {
        
      },
      data(){
        return{
          netState:true
        }
      },
      watch:{
        LOADING(val){
          console.log(val)
        }
      }
    }
    </script>
    <style>
    .loading{
      left:50%;
      margin-left:-15px;
      top:40%;
      z-index:999
    }
    #app{
      font-family: Avenir, Helvetica, Arial, sans-serif;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-align: center;
      color: #2c3e50;
    }
    body{
    margin:0px auto;
    padding:0px;
    }
    html, body{
      height: 100%;
       100%;
      background: #ececec;
    }
    html, body, ul, li, ol, dl, dd, dt, p, h1, h2, h3, h4, h5, h6, form, fieldset, legend, img { margin:0; padding:0; }

    fieldset, c{ border:none; }

    img{border: none;}

    address, caption, cite, code, dfn, th, var { font-style:normal; font-weight:normal; }

    ul, ol ,li{ list-style:none; }

    a { color:#666; text-decoration:none; }
    em{
      font-style: normal;
    }
    </style>
    ========有加载动画的store.js========
    import Vue from 'vue'
    import Vuex from 'vuex';
     
    Vue.use(Vuex);
     
    const store = new Vuex.Store({
        state: {
            LOADING: false,
        },
        mutations: {
            showLoading(state){
                state.LOADING = true    
            },
            hideLoading (state) {
                state.LOADING = false
            }
        }
    })
    export default store
  • 相关阅读:
    OnClose()和 OnDestroy()
    非计算机专业人员如何成为专业人员的学习之路
    【轉】白话文、简化字白化了文化,简化了思想
    【轉】研制汉字计算机的意义和可能性
    【轉】智慧的辨思:最优秀的语种 汉语
    安卓命令行操作备忘
    virtualbox 安装 android 经验总结
    【转】HTML5 LocalStorage 本地存储
    iOS开发之 获取手机的网络的ip地址
    iOS开发之 Xcode 6 创建一个Empty Application
  • 原文地址:https://www.cnblogs.com/wd163/p/12966385.html
Copyright © 2011-2022 走看看