随笔分类 - vue
vue
摘要:由于有些业务组件需要定义多个响应式props,类似这种(比较懒,没上ts),在vue3.3.x以前,如果不用三方库,代码会变得很繁琐 <script setup> const props = defineProps({ modelValue: { type: Object, default: ()
阅读全文
摘要:配置文件tsconfig.json的paths属性 "paths": { "@components/*": ["src/components/*"], "@assets/*": ["src/assets/*"], // css, html中需要 `~@assets/*` } config/index
阅读全文
摘要:检查template中是否存在和reactive变量相同的ref!!!!!
阅读全文
摘要:环境 vscode typescript4 vue3 问题描述 引入子组件报错 问题解决 去除子组件中定义为空的props及其他无用optional API。
阅读全文
摘要:环境 vscode typescript4 vue3 问题描述 首先,vue3中的全局变量及方法的配置较vue2中的变化大家应该已经知道了,不清楚的可以查看官方说明,但是按照官方文档结合typescript使用时遇到了问题: axios.ts // axios.ts import axios fro
阅读全文
摘要:网页可见区域宽: document.body.clientWidth 网页可见区域高: document.body.clientHeight 网页可见区域宽: document.body.offsetWidth (包括边线的宽) 网页可见区域高: document.body.offsetHeight
阅读全文
摘要:vue3 的 router-view keep-alive写法: <router-view v-slot="{ Component, route }"> <keep-alive :include="includeList"> <component :is="Component" :key="rout
阅读全文
摘要:不能再computed中改变页面变量的值,如果需要改变,请使用watch
阅读全文
摘要:directive.js import Vue from 'vue' // 提交验证 Vue.directive('clickOutside', { // 初始化指令 bind(el, binding, vnode) { function clickHandler(e) { // 这里判断点击的元素
阅读全文