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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] > [pinia.vuejs.org](https://pinia.vuejs.org/zh/introduction.html#basic-example) ## Pinia 狀態管理推薦是使用 Pinia,而不是vuex ## 安裝 ``` yarn add pinia # 或者使用 npm npm install pinia ``` ## 語法 在組合式 API 中 * `ref()`就是`state`屬性 * `computed()`就是`getters` * `function()`就是`actions` ## 技巧 ### 全局通知 1. 如果是簡單結構,無需索引,則直接暴露對象 設置 ``` // store export const useUserInfoStore = defineStore('userInfo', () => { const user = ref({} as User.ReqUser); }) ``` 引用 ``` const store = useUserInfoStore(); const { user } = storeToRefs(store); ``` 2. 如果是hash 中的數據,則使用 computed 設置 ``` const selfUser = computed(() => { return users.value[userId()] ; // 輸出必須為 非ref 的值 }) ``` 引用 ``` const {user} = storeToRefs(userStore()); 設置為動態更新 ``` 3. 返回對象中,帶參數的響應式 設置 ``` const getUser = computed(() => { return (user_id: string) => { if (users.value[user_id]) { return users.value[user_id] } else { throw new RuntimeException(`not found the user_id=${user_id}`) } } }) ``` 引用 ``` const {getUser} =storeToRefs(useUsers()) // 測試 cong getUser 中獲取的值帶有響應式 getUser.value(props.user_id).user_id ```
                  <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>

                              哎呀哎呀视频在线观看