About.vue 821 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <div class="about">
  3. <h1>This is an about page</h1>
  4. <el-button @click="commit">click</el-button>
  5. {{data || 'aaa'}}
  6. store.state获得数据:{{ this.$store.state.count }} store.getters获得数据:{{
  7. this.$store.getters.getcount
  8. }}
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. name: "app",
  14. data() {
  15. return {
  16. data: "",
  17. };
  18. },
  19. methods: {
  20. fetch() {
  21. this.$http
  22. .get("thing/station")
  23. .then((res) => {
  24. console.log(res.data);
  25. this.data = res.data;
  26. })
  27. .catch(function (error) {
  28. console.log(error);
  29. });
  30. },
  31. commit() {
  32. // this.$store.commit('update','33')
  33. // this.$store.dispatch('getupdate',66)
  34. },
  35. },
  36. created() {
  37. this.fetch();
  38. },
  39. mounted() {},
  40. };
  41. </script>