Open zhengwei1949 opened 5 years ago
<template> <div id="app"> {{list}} -- {{a}} -- {{aa}} <hr> <button @click="sendData">点击发送ajax</button> </div> </template> <script> import {mapState,mapGetters,mapMutations,mapActions} from 'vuex' export default { methods:{ ...mapMutations({ add:'add' }), async sendData(){ this.add(200) try{ const response = await this.$http.get('interface/blogs/all') const data = response.data console.log(data); }catch(err){ } } }, computed:{ ...mapState({ list:'list', a:'a' }), ...mapGetters({ aa:'aa' }) } } </script> <style> </style>