我在虚拟机中访问主机中的Vue网站,发现不能正常访问,打开浏览器调试模式,看到以下错误:
Uncaught SyntaxError: Block-scoped declarations (let, const, functionUncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode, class) not yet supported outside strict mode
错误原因:引入的配置文件需要严格模式。
解决方法:在导致错误的文件中加入:
"use strict";
参考:
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Strict_mode