Skip to content

Instantly share code, notes, and snippets.

@boenfu

boenfu/App.vue Secret

Created November 18, 2018 09:31
Show Gist options
  • Save boenfu/502dc13ded010e36a925638879a77848 to your computer and use it in GitHub Desktop.
Save boenfu/502dc13ded010e36a925638879a77848 to your computer and use it in GitHub Desktop.
Test vuexAlong
<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>
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