vue2遇到的一些错误
一、VUE中的VUEX如何调用modules里面的mutations和state
![0](https://img2023.cnblogs.com/blog/1347657/202307/1347657-20230730091939672-1189848760.png)
...mapMutations("workflow",['setApproverConfig', 'setApprover']),
二、Non-nested routes must include a leading slash character. Fix the following routes: - JSExpression
出错点
Non-nested routes must include a leading slash character. Fix the following routes:
非嵌套路由必须包含前导斜杠字符
{ path: '/JSExpressionTest', name: 'JSExpressionTest', component: () => import('@/components/JSExpressionTest') }
三、Vue报错:contains both .browserslistrc and package.json with browsers
删除.browserslistrc文件就好了
四、ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
运行别人的vue项目时,先使用npm install命令,再使用npm run serve命令。
在使用npm run serve命令时报错,错误如下:
ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
options has an unknown property ‘disableHostCheck’. These properties are valid: object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetup Middleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }
解决方法如下:
注释这一行即可
![0](https://img2023.cnblogs.com/blog/1347657/202307/1347657-20230730091939644-1117850593.png)