import { useState, useEffect } from '@tarojs/taro'
import { View } from '@tarojs/components'
// import getStore from "@/store"
import { getStore, inject, observer, useLocalStore } from '@tarojs/mobx'
const store = getStore()
function Test() {
const [confirm, setConfirm] = useState({
deliveryType: 0,
})
// const newStore = useLocalStore(() => store.shoppingConfirmNew)
// 方法一
// useEffect(() => {
// console.log('newStore--->', newStore)
// setConfirm(store.shoppingConfirmNew)
// }, [newStore.deliveryType])
// 方法二
useEffect(() => {
console.log('store--->', store)
setConfirm({...store.shoppingConfirmNew})
}, [store.shoppingConfirmNew.deliveryType])
return (
<View>
<View>{confirm.deliveryType}</View>
</View>
)
}
export default inject('shoppingConfirmNew')(observer(Test))