学习目标:vue3
项目实践
例如:
- 区分与2.0的不同
- 学习3.0写法
学习内容:
语法,基础用法
例如:
- compositon Api 和 options Api(2.0)
- script setup中一些特殊写法
获取 context 和 props
- defineProps
defineProps({msg: String})
- useContext
const ctx = useContext();
console.log(ctx.props);
-
ref语法糖:默认不支持,需要config增加配置
-
defineComponent
-
useStore
-
userRouter
-
. onmounted
-
toref、torefs
作用:拷贝响应式对象 ,双向绑定 -
toref - 拷贝对象属性
const state = reactive({
foo: 1,
bar: 2
})
const fooRef = toRef(state, 'foo')
- torefs - 拷贝对象
function useFeatureX() {
const state = reactive({
foo: 1,
bar: 2
})
const stateAsRefs = toRefs(state)
// 划重点,主要用于返回
return toRefs(state)
}
学习时间:
2022.08.04 ~
例如:
- 周一
记录:
es6:
- 判断:includes(),startsWith(),endsWith()
- 填充:padStart(),padEnd(),repeat()