-
-
Save boenfu/502dc13ded010e36a925638879a77848 to your computer and use it in GitHub Desktop.
Test vuexAlong
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="app"> | |
<h1>{{$store.state.num}}</h1> | |
<img alt="Vue logo" src="./assets/logo.png"> | |
<HelloWorld msg="Welcome to Your Vue.js App"/> | |
</div> | |
</template> | |
<script> | |
import HelloWorld from './components/HelloWorld.vue' | |
export default { | |
name: 'app', | |
components: { | |
HelloWorld | |
}, | |
mounted() { | |
this.$store.commit('add'); | |
// setTimeout(()=> { | |
// window.cleanVuexAlong('haha') | |
// },6000) | |
}, | |
} | |
</script> | |
<style> | |
#app { | |
font-family: 'Avenir', Helvetica, Arial, sans-serif; | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
text-align: center; | |
color: #2c3e50; | |
margin-top: 60px; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue'; | |
import vuex from 'vuex'; | |
import vuexAlong from 'vuex-along'; | |
Vue.use(vuex); | |
// vuexAlong.setKey('test'); | |
const state = { | |
num: 0, | |
}; | |
const mutations = { | |
add(state){ | |
state.num ++; | |
} | |
}; | |
export default new vuex.Store({ | |
state:state, | |
mutations:mutations, | |
plugins: [vuexAlong] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment