welcome

《VUE》学习日志

1.vue+element 键盘回车事件导致页面刷新的问题

ps:今天发现输入框输入内容后回车就会刷新页面。即:当一个 form 元素中只有一个输入框时,在该输入框中按下回车应提交该表单。如果希望阻止这一默认行为,可以在 标签上添加 @submit.native.prevent。

<el-form @submit.native.prevent>
</el-form>

 2.使用element-ui的菜单项点击两下(多次)出现 NavigationDuplicated {_name: "NavigationDuplicated", 报错

错误:NavigationDuplicated {_name: “NavigationDuplicated”, name: “NavigationDuplicated”, message: “Navigating to current location (”/home/huge") is not allowed", stack: “Error↵ at new NavigationDuplicated (webpack-int…e_modules/element-ui/lib/mixins/emitter.js:29:22)”}

解决方案:将此段代码放在路由文件即可解决问题

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

 

posted @ 2019-09-29 13:58  一首弦曲献仙音  阅读(284)  评论(0编辑  收藏  举报
//博文图片放大缩小 //飘桃花效果