上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 30 下一页
摘要: 在setup选项里使用watch有两种办法。 ## 第一种:使用watchEffect watchEffect立即执行传入的一个函数,同时响应式追踪其依赖,并在其依赖变更时重新运行该函数,可以接收watchEffect的返回值用来停止监听。 示例: ``` {{message}} 修改message 阅读全文
posted @ 2023-05-24 11:07 ZerlinM 阅读(554) 评论(0) 推荐(0)
摘要: ` // 通过props传过来的是一个静态值,如果需要赋值给双向绑定的数据 ``` * 带默认值的props ``` export interface Props { msg?: string labels?: string[] } const props = withDefaults(define 阅读全文
posted @ 2023-05-24 10:10 ZerlinM 阅读(524) 评论(0) 推荐(0)
摘要: 比如有以下对象 const obj = { num1: 1000, num2: 800, num3: 900, } 期望得到 num1: 1000这一项。 js实现代码: export const maxIncome = (userWalletIncomes) => { let maxValue = 阅读全文
posted @ 2023-05-09 09:11 ZerlinM 阅读(566) 评论(0) 推荐(0)
摘要: A页面跳转到B页面后,B页面在page上面定义了全局的变量,从B页面返回上级页面A后,再次进入B页面,会保留上次B页面全局变量更改后的数据,而不是重新初始化数据。 解决 page外部的变量,在小程序初始化的时候就加载了,并且中途不会变的。。 你可以试试,在非首页的页面的page外console.lo 阅读全文
posted @ 2023-05-06 16:31 ZerlinM 阅读(267) 评论(0) 推荐(0)
摘要: 项目中需要使用swiper,需要添加左右切换的按钮,代码如下: wxml <view> <block wx:if="{{list.length>1}}"> <van-icon bindtap="nextSwiper" name="arrow" class="arrow-left" color="#c 阅读全文
posted @ 2023-05-05 11:28 ZerlinM 阅读(893) 评论(0) 推荐(0)
摘要: 实现效果: 代码: const option = { // 环形图中间文字 title: { text: '1200', subtext: '总户数', textStyle: { fontSize: 16, color: '#333', fontWeight: 600, }, subtextStyl 阅读全文
posted @ 2023-04-28 15:35 ZerlinM 阅读(932) 评论(0) 推荐(0)
摘要: echarts作为我们前端小伙伴常用的可视化库,那我们画出有阴影的折线图,让折线图比较立体感。 可以使用折线图的 lineStyle 实现效果如图 代码如下: series: [ { data: [150, 230, 224, 218, 135, 147, 260], type: "line", s 阅读全文
posted @ 2023-04-28 10:46 ZerlinM 阅读(3657) 评论(0) 推荐(1)
摘要: 在树形结构中搜索 checkItems值为 某某某的数据,返回的是子数据。 const searchTree = (tree, checkItems) => { let res = ''; let state = false; const readTree = (_tree, _checkItems 阅读全文
posted @ 2023-04-24 17:59 ZerlinM 阅读(577) 评论(0) 推荐(0)
摘要: 微信小程序中加载图片时,如果只设定图片宽度,希望添加 mode = 'widthFix'来自适应 <Image mode="widthFix" className={s.img]} src={ImgSource.iconLogin} /> .img { width: 100%; } 但是这时会出现一 阅读全文
posted @ 2023-04-21 14:28 ZerlinM 阅读(566) 评论(0) 推荐(0)
摘要: 一、加载本地字体 做小程序项目时,有时为了提升页面展示效果,会引入一些第三方字体,引入方式如下代码片段 /*直接在app.css引入 */ @font-face { font-family: "alifont"; // 是你封装的名字 src: url('./static/css/subset-Al 阅读全文
posted @ 2023-04-21 09:17 ZerlinM 阅读(2776) 评论(0) 推荐(1)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 30 下一页