上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 31 下一页
摘要: 在setup选项里使用computed需要手动引入computed方法,computed接受一个 getter 函数,并根据 getter 的返回值返回一个不可变的响应式 ref 对象。或者,接受一个具有 get 和 set 函数的对象,用来创建可写的 ref 对象。下面来看示例。 父组件index 阅读全文
posted @ 2023-05-24 11:09 ZerlinM 阅读(129) 评论(0) 推荐(0)
摘要: 在setup选项里使用watch有两种办法。 ## 第一种:使用watchEffect watchEffect立即执行传入的一个函数,同时响应式追踪其依赖,并在其依赖变更时重新运行该函数,可以接收watchEffect的返回值用来停止监听。 示例: ``` {{message}} 修改message 阅读全文
posted @ 2023-05-24 11:07 ZerlinM 阅读(574) 评论(0) 推荐(0)
摘要: ` // 通过props传过来的是一个静态值,如果需要赋值给双向绑定的数据 ``` * 带默认值的props ``` export interface Props { msg?: string labels?: string[] } const props = withDefaults(define 阅读全文
posted @ 2023-05-24 10:10 ZerlinM 阅读(532) 评论(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 阅读(571) 评论(0) 推荐(0)
摘要: A页面跳转到B页面后,B页面在page上面定义了全局的变量,从B页面返回上级页面A后,再次进入B页面,会保留上次B页面全局变量更改后的数据,而不是重新初始化数据。 解决 page外部的变量,在小程序初始化的时候就加载了,并且中途不会变的。。 你可以试试,在非首页的页面的page外console.lo 阅读全文
posted @ 2023-05-06 16:31 ZerlinM 阅读(277) 评论(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 阅读(917) 评论(0) 推荐(0)
摘要: 实现效果: 代码: const option = { // 环形图中间文字 title: { text: '1200', subtext: '总户数', textStyle: { fontSize: 16, color: '#333', fontWeight: 600, }, subtextStyl 阅读全文
posted @ 2023-04-28 15:35 ZerlinM 阅读(955) 评论(0) 推荐(0)
摘要: echarts作为我们前端小伙伴常用的可视化库,那我们画出有阴影的折线图,让折线图比较立体感。 可以使用折线图的 lineStyle 实现效果如图 代码如下: series: [ { data: [150, 230, 224, 218, 135, 147, 260], type: "line", s 阅读全文
posted @ 2023-04-28 10:46 ZerlinM 阅读(3747) 评论(0) 推荐(1)
摘要: 在树形结构中搜索 checkItems值为 某某某的数据,返回的是子数据。 const searchTree = (tree, checkItems) => { let res = ''; let state = false; const readTree = (_tree, _checkItems 阅读全文
posted @ 2023-04-24 17:59 ZerlinM 阅读(584) 评论(0) 推荐(0)
摘要: 微信小程序中加载图片时,如果只设定图片宽度,希望添加 mode = 'widthFix'来自适应 <Image mode="widthFix" className={s.img]} src={ImgSource.iconLogin} /> .img { width: 100%; } 但是这时会出现一 阅读全文
posted @ 2023-04-21 14:28 ZerlinM 阅读(581) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 31 下一页