vue3+ts+vite项目开发--知识点梳理01
- 创建vue3项目
- 01 tsconfig.node.json文件中extends报错
- 02 知识点:用nvm安装最新版本的node
- 03. template标签中的#表示啥意思
- 04 ts中 ??使用
- 05 ts中 reduce
- 06 vue3+ts中watch和watchEffect监听使用
- 07 unocss用法积累
- 08 <el-col :xs="24":sm="12":lg="6" ></el-col>中属性理解
-
- 09 Vue3 中 createWebHistory 和 createWebHashHistory 的区别
- 10 pinia使用方法
- 11 vue3路由(基本用法、路由守卫、动态路由)
- 12 @iconify-json/ep理解
- 13 vite自动按需导入
- 14 vue3 - 按需导入使用Element Plus图标、iconify图标、本地SVG/PNG图标
- 15 vue3中defineComponent和defineAsyncComponent的区别及使用场景
- 16 element plus 引入icon 三种方法
- 17 Vue3的新API: markRaw和toRaw
- 18 border-color: currentcolor; currentcolor意义
- 19 text-size-adjust: 100% 有什么作用?
- 20 background-color: var(--el-bg-color-page);中--el-bg-color-page怎么定义的?
- 21 ES6之Array.from()方法
- 22 ts中的特殊符号 ?. ?: !. ?? || 等代表的含义与使用
- 23 reactive与ref区别有以下几方面:
- 24 Vue插件之install方法封装element-ui组件(按需引入)
- 25 Vue:自动按需导入element-plus图标
- 27 Object.assign(formData, data);
- 28 TS中class类的基本使用
- 29 typescript map方法
- 30 Vue3+Ts 组件通信方法
- 31 Vue3通信方式之defineProps、defineEmits、useAttrs、插件mitt和v-model
- 32 Vue3的defineProps方法
- 33 新特性-defineOptions
- 34 useVModel()的使用
- 35 vue3父子,跨组件之间通信
- 36 vue3 useVModel 实现父子组件双向数据绑定
- 37 watchEffect使用
创建vue3项目
参考vue3官方文档【快速上手】模块进行项目创建
快速上手
遇到的问题:
01 tsconfig.node.json文件中extends报错
解决:
npm install --save-dev @types/lodash
无效果的话就重启下项目
02 知识点:用nvm安装最新版本的node
查看可用的node版本,报错:Could not retrieve https://npm.taobao.org/mirrors/node/index.json.
原因:由于npm.taobao.org域名HTTPS证书到期更换为npmmirror.com
解决:
找到nvm安装路径的settings.txt文件
打开添加或者更改镜像地址,保存即可。
node_mirror: https://npmmirror.com/mirrors/node/
npm_mirror: https://npmmirror.com/mirrors/npm/
参考文章:https://blog.csdn.net/jieyucx/article/details/138080248
03. template标签中的#表示啥意思
v-slot 的缩写,即把参数之前的所有内容 (v-slot:) 替换为字符 #。例如 v-slot:header 可以被重写为 #header:
参考:https://ask.csdn.net/questions/7694480
04 ts中 ??使用
ts中??它用于判断一个值是否为 null 或 undefined,并在其为真时返回一个默认值。
const a= null;
const b= a ?? "jjj";
console.log(b); // 输出 "jjj"
需要注意的是,“??” 运算符只会在左侧的值为 null 或 undefined 时返回默认值,而不会在左侧的值为其他“假值”(如空字符串、0、false 等)时返回默认值。
05 ts中 reduce
06 vue3+ts中watch和watchEffect监听使用
参考:https://blog.csdn.net/m0_60893808/article/details/130899459
07 unocss用法积累
可通过:https://unocss.dev/interactive/
查看对应的css样式
<el-card class="!border-none !bg-transparent !rounded-4% w-100 <sm:w-85"></el-card>
.\!border-none {
border-style: none !important;
}
.\!bg-transparent {
background-color: transparent !important;
}
.\!rounded-4\% {
border-radius: 4% !important;
}
.w-100 {
width: 25rem;
}
@media (max-width: 639.9px) {
.\<sm\:w-85 {
width: 21.25rem;
}
}
其他的
.text-center {
text-align: center;
}
.bottom-1 {
//我的理解:1===4px===4/16=0.25rem
bottom: 0.25rem; //4px
}
.bottom-4 {
bottom: 1rem; //16px
}
.text-[10px] {
font-size: 10px;