Files
FreeERP.Applet/miniprogram/pages/components/card-plugin/card-plugin.ts
zhengw b1ecd88641 feat: 添加组件配置文件并优化页面结构
- 新增 components.d.json 文件,包含所有组件的属性配置
- 添加 card-item-plugin 组件及其相关文件(json、ts、wxml、wxss)
- 在 app.json 中添加新的生产流程管理页面路径
- 添加多个SVG图标文件用于菜单项
- 重构 popup-plugin 组件样式和关闭逻辑
- 更新 tab-bar-plugin 的激活状态逻辑
- 优化 search-popup 使用全局样式类
- 在首页添加菜单配置和页面跳转功能
- 调整组件样式细节和间距
2026-01-14 16:54:47 +08:00

66 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// pages/components/card_plugin/card_plugin.js
Component({
/**
* 组件的属性列表
*/
options: {
multipleSlots: true,
addGlobalClass: true,
},
properties: {
customStyle: null,
className: null,
headerStyle: null,
contentStyle: null,
footerStyle: null,
},
lifetimes: {
attached() {
setTimeout(() => {
this.getSlotHeight();
}, 100);
},
},
/**
* 组件的初始数据
*/
data: {
showMore: false,
showMoreBar: false,
},
/**
* 组件的方法列表
*/
methods: {
getSlotHeight() {
// 1. 创建组件内的节点查询器(必须加.in(this)
const query = wx.createSelectorQuery().in(this);
// 2. 查询插槽容器节点
query
.select("#contentSlot")
.boundingClientRect((rect) => {
if (rect) {
const height = rect.height; // 获取节点高度单位px
const fontSizeSetting = wx.getAppBaseInfo().fontSizeSetting;
this.setData({ showMoreBar: height >= fontSizeSetting * 3 * 1.57 });
// 可将高度通过自定义事件传递给父页面
// this.triggerEvent("slotHeightChange", { height });
} else {
// console.warn("未查询到插槽容器节点");
}
})
.exec(); // 执行查询
},
click(e: any) {
this.triggerEvent("tap", e);
},
showMoreTap() {
this.setData({
showMore: !this.data.showMore,
});
},
},
});