- 定位属性(position, top, right, bottom, left, z-index)
- 盒模型属性(display, float, width, height, margin, padding, border)
- 文字属性(color, font, text-align, text-decoration, text-shadow)
- 背景属性(background, background-color, background-image)
- 其他属性(cursor, opacity, transition, animation)
降低 particles.vue3 版本以及下载 tsparticles
在 env.d.ts 中添加对应的声明
declare module "particles.vue3";
npm i @type/node
store 持续化:
- 添加 pinia-plugin-persist 依赖
- 在 store 中添加 persist 参数
- pinia.use(piniaPluginPreset);
监听路由变化,默认 active 跟随路由
在子路由 path 中开头不写‘/’
// 失去响应用法:
import { useMainStore } from '@/stores/index'
const store = useMainStore()
const title = store.title
// 响应
import { useMainStore } from '@/stores/index'
import { storeToRefs } from 'pinia'
const store = useMainStore()
const { title } = storeToRefs(store)
获取 ref 内容时,需要带.value
import { useMainStore } from '@/stores/index'
const store = useMainStore()
const { expand } = storeToRefs(store)
//错误用法:
const styleComputed = computed(() => {
return expand
? {
width: '0px',
opacity: 0,
padding: '0',
}
: {
width: '120px',
opacity: 1,
padding: '0 10px',
}
})
// 正确
const styleComputed = computed(() => {
return expand.value
? {
width: '0px',
opacity: 0,
padding: '0',
}
: {
width: '120px',
opacity: 1,
padding: '0 10px',
}
})
解决方式:
- script 语句中添加 --skipLibCheck
- 在 tsconfig 配置添加 skipLibCheck: false