From af930887f9972b7dd21c80599e697e44f5e5a579 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 13 十一月 2024 14:05:04 +0800
Subject: [PATCH] 移除视频相关组件
---
miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.js | 32 +++++++++++++++++++++++---------
1 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.js b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.js
index f785d95..b7f12e5 100644
--- a/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.js
+++ b/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.js
@@ -8,6 +8,7 @@
import config from '../common/config';
import props from './props';
import { getRect } from '../common/utils';
+import { getObserver } from '../common/wechat';
let ARRAY = [];
const { prefix } = config;
const name = `${prefix}-swipe-cell`;
@@ -26,23 +27,36 @@
closed: true,
classPrefix: name,
};
- }
- attached() {
- ARRAY.push(this);
- }
- ready() {
- this.setSwipeWidth();
+ this.observers = {
+ 'left, right'() {
+ this.setSwipeWidth();
+ },
+ };
+ this.lifetimes = {
+ attached() {
+ ARRAY.push(this);
+ },
+ ready() {
+ this.setSwipeWidth();
+ },
+ detached() {
+ ARRAY = ARRAY.filter((item) => item !== this);
+ },
+ };
}
setSwipeWidth() {
Promise.all([getRect(this, `${ContainerClass}__left`), getRect(this, `${ContainerClass}__right`)]).then(([leftRect, rightRect]) => {
+ if (leftRect.width === 0 && rightRect.width === 0 && !this._hasObserved) {
+ this._hasObserved = true;
+ getObserver(this, `.${name}`).then(() => {
+ this.setSwipeWidth();
+ });
+ }
this.setData({
leftWidth: leftRect.width,
rightWidth: rightRect.width,
});
});
- }
- detached() {
- ARRAY = ARRAY.filter((item) => item !== this);
}
open() {
this.setData({ opened: true });
--
Gitblit v1.9.3