赞
踩
注意:created()方法是无效的
方法:在需要刷新的页面添加以下内容
watch:{
$route(){
//跳转到该页面后需要进行的操作
}
},
(1)子组件
onSubmit () { this.$http[!this.form.id ? 'post' : 'put']('/cd/question', {...this.form}).then(({ data: res }) => { if (res && res.code === 0) { this.$message({ message: '操作成功', type: 'success', duration: 500, onClose: () => { } }) this.$router.push({ name: 'user-question' }) } else { this.$message.error(res.msg) } }) },
(2)父组件(user-question)
在子组件用this.$emit('refreshDataList', true);
无效
所以在父组件使用监听路由的方法
watch: {
$route () {
this.getDataList();
}
},
this.getDataList()
:是列表查询的方法
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。