更新记录
1.0(2024-03-13)
下载此版本
1.0 重构mini-programs-rc项目事件定位及事件嵌套处理流程,组件调用参考附件示例,接口使用相关方法
参考资料:http://t.csdnimg.cn/L3K29
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
× |
× |
× |
× |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
× |
× |
× |
× |
× |
× |
× |
× |
× |
<!--
* @Author: feng.han gyi2020@163.com
* @Date: 2024-03-13 10:36:56
* @LastEditors: feng.han gyi2020@163.com
* @LastEditTime: 2024-03-13 11:02:54
* @FilePath: /wx-client/src/uni_modules/cax/readme.md
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
canvas 事件嵌套&页面布局
调用示例部分代码
import { onMounted, getCurrentInstance } from 'vue';
import cax from "@/utils/cax/index"
const instance = getCurrentInstance();
const { Stage, Group, Rect, RoundedRect } = cax
const render = () => {
const { childWidth, spacing } = data.layoutParams
stage.empty()
data.beats.forEach((beat: any, key: number) => {
const group: any = new Group();
group.x = (childWidth + spacing) * key;
group.y = 0
beat.forEach((v: any, k: number) => {
let fillStyle = "#282828"
if (v.valid) {
fillStyle = key === curIndex ? "#F00" : "#5f5f5f"
}
const roundedRect: any = new RoundedRect(childWidth, REACT_HEIGHT, 4, { fillStyle });
roundedRect.y = REACT_Y * (2 - k)
group.add(roundedRect);
})
group.on('touchstart', handleFrequency);
stage.add(group);
})
stage.update();
}
const queryNode = (select: string) => {
return new Promise((resolve, reject) => {
uni
.createSelectorQuery()
.in(instance)
.select(select)
.node((data) => {
resolve(data.node);
})
.exec();
});
};
const initCanvas = async () => {
canvas = await queryNode('#canvas');
stage = new Stage(canvas, data.width, data.height);
render()
}
onMounted(() => {
initCanvas()
})