<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                http://jsrun.net/CcLKp/edit ## Vuex Vuex是Vue.js 的狀態管理模式。 適用在大型單頁應用。 ## 核心內容 * state 存放狀態數據 * mutations , 對state的成員操作 * getters 加工state成員給外界使用 * actions 異步操作 * modules 模塊化狀態管理 ## Vuex VS. 簡單的store模式 ``` var store = { debug: true, state: { message: 'Hello!' }, setMessageAction (newValue) { if (this.debug) console.log('setMessageAction triggered with', newValue) this.state.message = newValue }, clearMessageAction () { if (this.debug) console.log('clearMessageAction triggered') this.state.message = '' } } ``` Store ,倉庫,基本就是一個容器, 包含著應用中大部分狀態(state)。 ## Vuex VS. 單純的全局對象 1. Vuex 的狀態存儲是響應式的,Store變化,組件也自動變化 2. 不能直接改變Store中代替狀態 ## Vuex 使用示例 ``` <template> <div> <h2>Store Demo</h2> <hr> <h4> {{$store.state.myCount}}</h4> <button @click="addMethod"> Add </button> </div> </template> <script> import store from '@/store' export default { name:'myCount', store, data(){ }, methods:{ addMethod(){ this.$store.commit('add'); } } } </script> <style scoped> </style> ``` ``` export default new Vuex.Store({ state: { myCount:1 }, mutations: { add(state){ state.myCount++; },minus(state){ state.myCount--; } }, actions: { }, modules: { } }) ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看