zoukankan      html  css  js  c++  java
  • Vuex的基本使用

    1、安装vuex依赖包

    npm install vuex --save

    2、导入vuex包

    import  vuex from 'vuex'

    3、创建store对象

    const store =  new Vuex.store({

    //state中存放的就是全局共享的数据

    state:{count : 0}

    })

    4、将store对象挂载到vue实例中

    new Vue({

    el;'#app',

    render: h => h(app)

    router,

    //将创建的共享数据对象,挂载到vue实例中

    //所有的组件,就可以直接从store中获取全局数据了

    store

    })

    window+R进入cmd命令窗口

     

     

     

     

     

  • 相关阅读:
    go
    go
    go
    postgresql
    go
    go
    sql
    铂金软件公司
    HRIS 的价值评估
    [转]数据库SQL优化大总结之 百万级数据库优化方案
  • 原文地址:https://www.cnblogs.com/semth/p/14151863.html
Copyright © 2011-2022 走看看