问题汇总(微信小程序)

自定义指令

小程序不支持 Vue.directive() 自定义指令

微信webview字体闪烁问题

1
2
3
body {
-webkit-text-size-adjust: 100% !important;
}

iOS Date 问题

iOS微信小程序 Date.now() 只能处理 “/” 分隔的日期。

参考:https://blog.csdn.net/qq_40745143/article/details/108142314

微信小程序多层 v-for 问题

当布局中存在多层 v-for 嵌套时,里层的点击事件传值会发生错乱。

2种解决方法:

  1. 将里层的 v-for 封装成组件
  2. 使用 data- 自定义特性传递参数

自定义特性

1
2
3
4
5
6
7
<view
v-for="(item, index) in list"
:key="item.id"
:data-params="item"
@click="click"
>
</view>

js

1
2
3
click(e) {
const item = e.currentTarget.dataset.params;
}

微信小程序隐藏滚动条

https://blog.csdn.net/qq_61672548/article/details/126013149

隐私协议

小程序用户隐私保护指引内容介绍 | 微信开放文档