会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Amusement park flat by Lina
light丶
博客园
首页
新随笔
联系
订阅
管理
2024年11月3日
pc大屏适配
摘要: 在文件utils里配置 const baseSize = 12 //设置rem函数 function setRem() { //页面宽度相对于设计图宽的缩放比例,根据需要修改 1920(设计稿宽度) const scale = document.documentElement.clientWidth
阅读全文
posted @ 2024-11-03 15:30 light丶
阅读(22)
评论(0)
推荐(0)
2024年6月29日
react创建项目
摘要: 命令: npx create-react-app 项目名称 1。npx:node.js的工具命令 查找并执行后续的命令包 2。create-react-app 核心包(固定写法),用于创建react项目 3。项目名称 react的项目名称(自定义)
阅读全文
posted @ 2024-06-29 13:14 light丶
阅读(8)
评论(0)
推荐(0)
2024年6月19日
vue3的defineEmitsi类型声明注解
摘要: //格式:defineEmits<{(e:事件名,val:数据类型):void}>() const emit = defineEmits<{ (e: 'get-msg', val: string): void, (e: 'say-hello', num: number): void }>() con
阅读全文
posted @ 2024-06-19 21:02 light丶
阅读(73)
评论(0)
推荐(0)
vue3的defineProps接收类型注解
摘要: //这是没有用ts语法接收的props参数 defineProps({ color: String, size: { type: String, required: false, default: 'middle' }, }) //TS语法 //格式:withDefaults(defineProps
阅读全文
posted @ 2024-06-19 21:01 light丶
阅读(454)
评论(0)
推荐(0)
vue3的computed计算属性返回值注解
摘要: //语法结构:computed<返回值的类型>() 列子 //定义数据 const cuont = ref(0) type Item = { id: string name: string price: number } const list = ref<Item[]>([{ id: '1001',
阅读全文
posted @ 2024-06-19 20:53 light丶
阅读(345)
评论(0)
推荐(0)
vue3非空断言!号设置属性
摘要: html <div ref="divRef"> </div> <button @click="sethtml"></button> js //非空断言 :我们比ts更加清楚数据不是空值 const divRef = ref<HTMLDivElement | null>(null) const set
阅读全文
posted @ 2024-06-19 20:49 light丶
阅读(60)
评论(0)
推荐(0)
vue3事件形参定义类型
摘要: html <input type="text" @change="changeInput"> <p @click="showInfo(33)">点击输出33</p> <button @click="logInfo">点击</button> js //给形参定义类型event const change
阅读全文
posted @ 2024-06-19 20:45 light丶
阅读(38)
评论(0)
推荐(0)
vue3标签模板上的ref类型注解
摘要: 子组件 <script setup lang="ts"> import { ref, defineExpose } from 'vue'; const num = ref<number>(10) defineExpose({ num,//把值暴露出去,父级可以通过ref获取 }) </script>
阅读全文
posted @ 2024-06-19 20:37 light丶
阅读(79)
评论(0)
推荐(0)
vue3的reactive变量声明类型注解
摘要: 1 使用默认类型 const person = reactive({ name: 'zs', age: 20 }) console.log(person.name); 2 使用泛型 type GoodType = { name: string id: number price: number pic
阅读全文
posted @ 2024-06-19 20:24 light丶
阅读(93)
评论(0)
推荐(0)
vue3的ref变量声明类型注解
摘要: 1使用默认类型 const str = ref("") str.value = 'tom 2 //使用泛型 const num = ref<number>() num.value = 20 type GoodType = { id: string name: string price: number
阅读全文
posted @ 2024-06-19 20:19 light丶
阅读(143)
评论(0)
推荐(0)
下一页
公告