0
我想了解MobX並創建一個簡單的存儲中刪除一個字段。沒有這個裝飾器字段存在於對象中。 裝載機在webpack.config:MobX @observable裝飾從商店
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
query: {
presets: ["react", "es2015"],
plugins: ["react-html-attrs", "transform-class-properties", "transform-decorators-legacy"]
},
loader: "babel"
}
]
}
你是如何檢查對象是否具有'someField'?我認爲mobx爲該領域提供了一個吸氣劑,因此它可能不會在該對象上顯示爲正常字段。試着做'window.store.someField'並看看你得到了什麼。 –
'window.store.someField'返回undefined –
這絕對不是正常的行爲。你可以檢查是否有其他模塊重寫'window.store'?看看這個小提琴:https://jsfiddle.net/mdebbar/uyjoq1s0/4/它工作得很好。 –