vuex學習簡單筆記

2021-10-02 21:10:55 字數 1762 閱讀 8886

vuex狀態管理:具體介紹隨時查官網簡介

state:類似於在例項data中定義乙個變數

getter:有點像計算屬性computed.接受state作為第乙個引數

const store =

newvuex.store(,

]}, getters:}}

)

store.getters.donetodos // ->
mutation:類似例項的methods中定義的方法

//定義

const store =

newvuex.store(,

mutations:}}

)//呼叫

store.

commit

('increment'

)//count = 2

//還可以傳入額外的引數(載荷方式)

mutations:

}store.

commit

('increment',)

//count = 11

action:類似於mutation,但是action相當於提交mutation,並且最重要的是它可以包含非同步操作

const store =

newvuex.store(,

mutations:},

actions:}}

)//這樣呼叫action的方法(action同樣支援載荷方式)

store.

dispatch

('increment'

)

module:我理解的就是在狀態管理中內容比較複雜和多的時候,將這些內容分割為模組(module).

const modulea =

, mutations:

, actions:

, getters:

}const moduleb =

, mutations:

, actions:

}const store =

newvuex.store(}

)store.state.a // -> modulea 的狀態

store.state.b // -> moduleb 的狀態

每個模組內部的mutation和getter,接收的第乙個引數為模組的區域性物件

const store =

newvuex.store(,

// 模組內的狀態已經是巢狀的了,使用 `namespaced` 屬性不會對其產生影響

getters:

// -> getters['account/isadmin']},

actions:

// -> dispatch('account/login')},

mutations:

// -> commit('account/login')},

// 巢狀模組

modules:

, getters:

// -> getters['account/profile']}}

,// 進一步巢狀命名空間

posts:

, getters:

// -> getters['account/posts/popular']}}

}}}}

)

深度學習簡單筆記

各方法在訓練中對應的作用簡單解釋 微積分 求導 梯度下降法 求最優解 最小二乘法 尋找資料的最佳函式匹配 樸素葉貝斯 回歸 分類 極大似然估計 將概率最大化的引數作為真實估計值使用。似然函式 對數似然 取對數可以將連乘轉為連加且不影響單調性,但其實可能更重要的一點是概率的連乘將會變成乙個很小的值,可...

Qt學習筆記 初學簡單筆記

1.ubuntu下終端命令安裝qt4 sudo apt get install qt4 dev tools 開發包 sudo apt get install qtcreator ide sudo apt get install qt4 doc 開發幫助文件 sudo apt get install ...

學習 演算法 個人簡單筆記

這幾天的簡單記錄其實大部分還是在我 裡面,這是只是一些簡單的記錄 位運算 和 和 補0 對於int 有1 35 取模後變3 與1 3相同,long就是按64取模 位運算可以實現沒有第三個值的情況下,交換兩個數 a00110011 b10101111 b10011100 a10101111 原理 ab...