创建v3 + ts + vite项目报错
declare module '*.vue' {
import { ComponentOptions } from 'vue'
const componentOptions: ComponentOptions
export default componentOptions
}
依旧报红
不知道你这个问题是否已经解决, 如果还没有解决的话:使用插件:
amfe-flexible
postcss-pxtorem
1、
安装 amfe-flexible
主要是将1rem设为viewWidth/10。
npm install amfe-flexible --save
//main.ts
import 'amfe-flexible';
2、
npm install postcss-pxtorem --save
在src同级目录下创建 postcss.config.js
rootValue 的值为设计稿10分之一的大小,比如750px的设计稿 rootValue则为75
module.exports = {
"plugins": {
'postcss-pxtorem': {
rootValue: 75,
propList: ['*']
}
}
}
3、
index.html中
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
很抱歉,参考资料中并没有提到添加.ts文件的问题以及相关的报错和红色提示。所以我需要更多的信息来帮助你解决这个问题。具体来说,我需要看到你的代码和错误信息,才能给出相关的解决方案。