add vuex
This commit is contained in:
1 parent
7b98c36a1e
commit
504097d407
4 files changed
+33
-22
No files matched your search
+2
-1
@@ -2,5 +2,6 @@ import { createApp } from 'vue';
|
||||
import App from './App.vue';
|
||||
import './style.css';
|
||||
import router from './router/index';
|
||||
import store from './store/index';
|
||||
|
||||
createApp(App).use(router).mount('#app');
|
||||
createApp(App).use(router).use(store).mount('#app');
|
||||
@@ -0,0 +1,21 @@
|
||||
import { createApp } from 'vue';
|
||||
import { createStore } from 'vuex';
|
||||
|
||||
interface IState {
|
||||
count: number;
|
||||
}
|
||||
|
||||
const store = createStore({
|
||||
state(): IState {
|
||||
return {
|
||||
count: 0
|
||||
};
|
||||
},
|
||||
mutations: {
|
||||
increment(state: IState) {
|
||||
state.count++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default store;
|
||||
Reference in new issue
Block a user