vue.js - 使用路由处理单击另一个组件内的组件?
问题描述
我的模板中有这种结构
<div to="/route/route1">
<i class="material-icons">airplay</i>
<span>Title</span>
<custom-button @click.native="doSomething"></custom-button>
</div>
通过单击自定义按钮,我想调用此方法并导航到另一条路线
doSomething() {
this.$router.push({path: 'route/route2'});
}
现在,当我单击自定义按钮时,我仍然会去route1
有没有办法用这种结构来完成这项工作?
解决方案
推荐阅读
- reactjs - 在电子上使用 webpack 有什么好处?
- excel-formula - 将多个 IF 语句组合成一个公式
- java - 我应该使用哪个运算符来比较两个 LocalDate 值?
- environment-variables - JetBrains Rider:无法更改项目配置文件中的环境变量
- java - Android如何使用模态类的arraylist填充适配器中的详细信息
- javascript - 用户在网页 + Iframe 上花费的时间
- python - Pygame/MoviePy - 视频显示的帧率很差,窗口大小比我的屏幕大
- python - 读取txt文件
- javascript - 尝试在我的国家公园项目中添加 2 个字符的州代码
- python-3.x - 如何确定树莓派是否足够强大以运行我的代码?