6. 在组件中使用
methods: {
async recover(id) {
const {
data: { code, message }
} = await this.$store.$api.get('frontend/comment/recover', { id })
if (code === 200) {
this.$store.commit('global/comment/recoverComment', id)
}
}
}
示例文件: src/components/frontend-comment.vue
至此, 全文结束, 完整代码, 请参考: https://github.com/lincenying/mmf-blog-vue2-pwa-ssr










