You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
999 B
55 lines
999 B
import { getNodeRect, nextTick } from "@utils/tools";
|
|
|
|
const systemInfo = wx.getSystemInfoSync();
|
|
const rpx = systemInfo.windowWidth / 750;
|
|
|
|
// 头像组件
|
|
Component({
|
|
properties: {
|
|
row: {
|
|
type: Number,
|
|
value: 3,
|
|
},
|
|
lineHeight: {
|
|
type: Number,
|
|
value: 60,
|
|
},
|
|
},
|
|
|
|
data: {
|
|
initOk: false,
|
|
|
|
isFolded: false,
|
|
|
|
noNeedFold: false,
|
|
},
|
|
|
|
lifetimes: {
|
|
ready() {
|
|
this.init();
|
|
},
|
|
},
|
|
|
|
methods: {
|
|
async init() {
|
|
await nextTick();
|
|
|
|
const { height } = await getNodeRect("cnt", this);
|
|
const { row, lineHeight } = this.data;
|
|
|
|
let noNeedFold = height / row < lineHeight * rpx||height / row == lineHeight * rpx;
|
|
|
|
this.setData({
|
|
noNeedFold,
|
|
isFolded: !noNeedFold,
|
|
initOk: true,
|
|
});
|
|
},
|
|
|
|
shiftFold() {
|
|
let { isFolded } = this.data;
|
|
isFolded = !isFolded;
|
|
this.setData({ isFolded });
|
|
},
|
|
},
|
|
});
|
|
|