1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <template>
- <div class="about">
- <h1>This is an about page</h1>
- <el-button @click="commit">click</el-button>
- {{data || 'aaa'}}
- store.state获得数据:{{ this.$store.state.count }} store.getters获得数据:{{
- this.$store.getters.getcount
- }}
- </div>
- </template>
- <script>
- export default {
- name: "app",
- data() {
- return {
- data: "",
- };
- },
- methods: {
- fetch() {
- this.$http
- .get("thing/station")
- .then((res) => {
- console.log(res.data);
- this.data = res.data;
- })
- .catch(function (error) {
- console.log(error);
- });
- },
- commit() {
- // this.$store.commit('update','33')
- // this.$store.dispatch('getupdate',66)
- },
- },
- created() {
- this.fetch();
- },
- mounted() {},
- };
- </script>
|