JavaScript/vue.js/error

来自康健生活
Kangkk​(留言 | 贡献)2020年7月2日 (四) 12:35的版本 (→标题文字)

标题文字

  • Cannot assign to read only property 'exports' of object '#<Object>'
    js 可以混用 require、export。但是不能混用import、module.exports
  • Unknown custom element: <el-menu> - did you register the component correctly
    没有引用 element-ui
    import ElementUI from 'element-ui'; //element-ui的全部组件
    Vue.use(ElementUI); //使用elementUI
    
  • Invalid prop: type check failed for prop "collapseTransition". Expected Boolean, got String with value "false".
    类型错误,加:即可
    :collapse-transition="false"
    
  • TypeError: Cannot read property 'openedMenus' of undefined,在使用 elementui 时出现错误,按需子组件 vue 页面加载即可
    import {Menu, Submenu, MenuItem, MenuItemGroup} from 'element-ui';
    Vue.use(Menu);
    Vue.use(Submenu);
    Vue.use(MenuItem);
    Vue.use(MenuItemGroup);
    
  • Unknown custom element: <el-menu> - did you register the component correctly? For recursive components, make sure to provide the "name" option
    耗时 5 个小时,试过多个 webpack 方案,经过仔细爬坑,是因为 vue 与 ejs 不兼容导致的(vue-loader 与 html-webpack-plugin 和 ejs-compiled-loader)