会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
zw11111
博客园
首页
新随笔
联系
订阅
管理
2024年10月30日
css 自定义字体 font-face
摘要: @font-face { font-family: '名字'; src: url('mycustomfont.woff2') format('woff2'), font-weight: normal; font-style: normal; font-display: swap; } 放到公共样式最
阅读全文
posted @ 2024-10-30 16:13 小白张先生
阅读(33)
评论(0)
推荐(0)
2024年5月17日
ECharts封装及常用配置整理
摘要: 1 参考了文献: https://blog.csdn.net/Xxxxxl17/article/details/135112347
阅读全文
posted @ 2024-05-17 15:06 小白张先生
阅读(22)
评论(0)
推荐(0)
2024年5月15日
vue3 前端大屏项目适配方法
摘要: 1 scale()方法 //屏幕内的内容 // 样式部分 .contain { width: 100vw; height: 200vh; background: url(.pic); backgrouns-size:cover } .screen { display: inline-block; w
阅读全文
posted @ 2024-05-15 15:33 小白张先生
阅读(1531)
评论(0)
推荐(0)
ts中的type 和 interface 区别
摘要: type 可以用来给一个类型起个新名字,当命名基本类型或联合类型等非对象类型时非常有用, 而接口不行 type MyNumber = number; type StringOrNumber = string | number; type Text = string | string[]; 2 类型别
阅读全文
posted @ 2024-05-15 09:33 小白张先生
阅读(82)
评论(0)
推荐(0)
2024年5月13日
Vue3得通信方式
摘要: 1 父向子 props (defibeProps) , 子向父自定义事件(defineEmits) 2 时间总线(mitt插件) 3 v-model (可以绑定多个v-model) a 给子组件传递props[modelValue] b 给子组件传递自定义事件 @update:modelValue
阅读全文
posted @ 2024-05-13 17:07 小白张先生
阅读(34)
评论(0)
推荐(0)
2024年5月10日
React的高阶组件详解
摘要: 接受一个或多个函数作为参数; 返回一个新的函数; 2 使用场景(页面权限, 某些页面是必须用户登录成功才能进行进入;如果用户没有登录成功,那么直接跳转到登录页面;) // 定义一个高阶组件, 用于鉴权的操作 function loginAuth(WrapperCpn) { return props
阅读全文
posted @ 2024-05-10 15:06 小白张先生
阅读(30)
评论(0)
推荐(0)
2024年5月9日
useContext及使用场景
摘要: 1.使用 createContext 创建一个 Context对象,创建一个“上下文” 2.使用 Provider 提供值 value 3.使用 useContext 访问createContext 返回的 Context对象 import React, { useContext, createCo
阅读全文
posted @ 2024-05-09 16:55 小白张先生
阅读(233)
评论(0)
推荐(0)
什么是受控组件
摘要: 1 在 react 中,Input textarea 等组件默认是非受控组件(输入框内部的值是用户控制,和React无关)。但是也可以转化成受控组件,就是通过 onChange 事件获取当前输入内容,将当前输入内容作为 value 传入,此时就成为受控组件。 class TestComponent
阅读全文
posted @ 2024-05-09 16:10 小白张先生
阅读(15)
评论(0)
推荐(0)
useffect 模拟生命周期 及与useLayoutEffect的区别
摘要: 一 useffect 1 模拟componentDidMount 第二个参数为一个空数组,可以模拟componentDidMount componentDidMount:useEffect(()=>{console.log('第一次渲染时调用')},[]) 2 模拟componentDidUpdat
阅读全文
posted @ 2024-05-09 15:53 小白张先生
阅读(78)
评论(0)
推荐(0)
hooks父组件怎么调用子组件的方法?
摘要: 父组件使用 useRef 创建一个 ref 传入 子组件; 子组件需要使用useImperativeHandle 暴露 ref 自定义的实例值给父组件。这个需要用 forwardRef 包裹着。 父组件 const ref = useRef() ref.current & ref.current.i
阅读全文
posted @ 2024-05-09 15:36 小白张先生
阅读(184)
评论(0)
推荐(0)
下一页
公告