归档:2022年4月
  • [VUE]"TypeError: Cannot read property 'validate' of undefined"

    2022-04-19 在Vue表单验证时出现以下报错信息:[Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'validate' of undefined" ...... 在这里的formName需要和保持一致才行。代码1:this.$refs[formName].validate((valid) => { ... }代码2:<el-form ref="ruleForm" label-width="120px" :model="ruleFo...
    前端 - 去评论 - 221人浏览
  • 如何去掉vue路径中的“#”号

    2022-04-11 如何去掉vue路径中的“#”号我们在vue项目中使用vue-router时,路径中会有 # 号,这样看着也不舒服(例如“http://localhost:3000/#/”)。其实是因为路由有两种模式 hash 和 history,我们平时直接使用的是默认的hash,所以路径会有 # 号,因此我们只需要修改成 history 就可以了,如下图: 接下来就改了下vue-router的模式export default new Router({ mode: 'history', routes: [ ... ] })改成‘history’模式,‘#’就去掉了,很开心。然而打完...
    前端 - 去评论 - 224人浏览