vue项目:SyntaxError: Unexpected token ‘:‘

运行项目时出现了如下问题:

在这里插入图片描述

经过排查,是因为代码中使用了ts(TypeScript)的写法:

vue项目:SyntaxError: Unexpected token ‘:‘_第1张图片

解决办法:在script标签加上 lang=“ts” 即可

vue项目:SyntaxError: Unexpected token ‘:‘_第2张图片

你可能感兴趣的:(vue.js,前端,javascript)