插件volar安装了没有提示。
解决:1. 检查是或否是最新的版本,是的话进入拓展设置,所有的选项都勾选
2. 还是不行就要更新vscoe了。一般的话会在力捕抓到一个错误。跟新就好了
TypeScript intellisense is disabled on template. To enable, configure "jsx": "preserve"
in the "compilerOptions"
property of tsconfig or jsconfig. To disable this prompt instead, configure "experimentalDisableTemplateSupport": true
in "vueCompilerOptions"
property.volar
解决:
打开jsx设置
如果你装了eslint刚开始会也会红线提示
解决:
“vue/multi-word-component-names”: “off”
配置代理
vite.config.ts
export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://101.43.207.24:1190',
rewrite: (path) => path.replace(/^\/api/, ''),
changeOrigin: true
},
// '/storage/file': {
// target: '目标服务器2'
// }
}
},
})
eslint 配置文件出现报错
解决:
‘env’: {
‘browser’: true,
‘es2021’: true,
‘node’: true
},
‘extends’: [
‘eslint:recommended’,
‘plugin:vue/vue3-essential’
],
vite3.0区分不同的环境
解决:使用import.meta.env.VITE_SOME_KEY
文档指出只有VITE_开头的变量才会显示,其他都是undefined
类型“ImportMeta”上不存在属性“env”。
在 tsconfig.json 文件中添加如下配置即可
“types”: [ “vite/client” ]
vue3中的less使用ts的变量
v-bind
js-cookie刷新一次就在原有的token再新加一个token
从执行的步骤来看,刷新页面一次。就会执行一次封装的setTokne方法,所以加上判断旧可以了
import {
defineStore } from 'pinia'
import {
Names } from '../storeNamespace'
import Cookies from 'js-cookie'
const cookiesStorage