如何在vue js上观看路由对象?这是我的代码
watch: {
'$route.params.search': function(search) {
console.log(search)
}
}
Run Code Online (Sandbox Code Playgroud)
没用
我尝试使用深度仍然无法在这里工作
查看代码sanbox,您可以在main.js上观看route对象。
您不应该在任何其他组件内监视route对象。因为当路由器链接更改时组件会被破坏。您应该根据目录结构在main.js文件中执行此操作
谢谢@santanu和@ittus
我使用 jquery 与 api rest 通信数据。并使用 vue js 将数据渲染到我的模板,但我有错误。
[Vue warn]: Error in render function: "TypeError: Cannot read property 'first_name' of undefined"
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
var dashboard = new Vue({
el: '#dashboard',
data:{
profile: {}
}
});
axios.get(url_profile, { headers: {"Authorization": "JWT " + token} })
.then(function(res){
dashboard.$data.profile = res.data;
})
.catch(function(err){
toastr.err(err);
});
Run Code Online (Sandbox Code Playgroud)
谢谢。
嗨,我有一个关于触发组件 b-form-file 的问题。
<b-form-file ref="imageProfile"></b-form-file>
Run Code Online (Sandbox Code Playgroud)
我尝试使用 this.$refs.imageProfile.click() 不起作用。而且我在该元素上没有找到单击功能。
谢谢你。