Open happy0402 opened 3 years ago
StoreUtils.ts class StoreUtils { static store: any } export default StoreUtils
app.vue import StoreUtils from '@/utils/StoreUtils' export default defineComponent({ name: 'App', components: { }, setup() { const store = useStore() StoreUtils.store = store .......
other.ts import StoreUtils from '@/utils/StoreUtils' StoreUtils.store.getter(['app/settoken']);
What problem does this feature solve?
import {useStore} from 'vuex';
console.log(useStore()); //>> undefined
What does the proposed API look like?
//request_util.ts import {useStore} from 'vuex';
const store = useStore(); store.getter(['app/settoken']);