久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      vue.js如何安裝vuex

      vue.js安裝vuex的方法:首先進(jìn)入項(xiàng)目路徑后,在項(xiàng)目終端輸入相關(guān)代碼;然后在項(xiàng)目的package json文件中顯示vuex插件;接著在項(xiàng)目src目錄中新建store js;最后在【main.js】中應(yīng)用vuex即可。

      vue.js如何安裝vuex

      本教程操作環(huán)境:windows7系統(tǒng)、Vue2.9.6版,該方法適用于所有品牌電腦。

      vue.js安裝vuex的方法:

      1、安裝:

        進(jìn)入項(xiàng)目路徑后,在項(xiàng)目終端輸入:npm install vuex --save 或者 cnpm install vuex --save

      2、安裝完成后,會(huì)在項(xiàng)目的package.json文件中顯示vuex插件,如下:

        "dependencies": {     "vue": "^2.5.2",     "vue-router": "^3.0.1",     "vuex": "^3.3.0"   },

      3、再項(xiàng)目src目錄中新建store.js,文件內(nèi)容如下:

      import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex); export default new Vuex.Store({     //所有的數(shù)據(jù)都放在state中     state:{},     //操作數(shù)據(jù),唯一的通道是mutations     mutations:{},     //actions,可以來做異步操作,然后提交給mutations,而后再對(duì)state(數(shù)據(jù))進(jìn)行操作     actions:{} })

      4、在main.js中應(yīng)用vuex:

        導(dǎo)入store,然后再new Vue中使用,代碼如下:

      // The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. import Vue from 'vue' import App from './App' import router from './router' import store from './store'   //導(dǎo)入store Vue.config.productionTip = false /* eslint-disable no-new */ new Vue({   el: '#app',   router,   store,   //在new Vue中使用   components: { App },   template: '<App/>' })

      相關(guān)免費(fèi)學(xué)習(xí)推薦:javascript(視頻)

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)