From 5036880fc037e5d112206b93a729f60be12bf8ab Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 07 十一月 2024 17:03:13 +0800
Subject: [PATCH] 2024.11.07 bug修复
---
miniprogram_npm/tdesign-miniprogram/fab/fab.js | 46 +++++++++++++++++++++++++++++++++-------------
1 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/miniprogram_npm/tdesign-miniprogram/fab/fab.js b/miniprogram_npm/tdesign-miniprogram/fab/fab.js
index 9bb7655..bbcefa0 100644
--- a/miniprogram_npm/tdesign-miniprogram/fab/fab.js
+++ b/miniprogram_npm/tdesign-miniprogram/fab/fab.js
@@ -7,37 +7,57 @@
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
+import useCustomNavbar from '../mixins/using-custom-navbar';
+const systemInfo = wx.getSystemInfoSync();
const { prefix } = config;
const name = `${prefix}-fab`;
+const baseButtonProps = {
+ size: 'large',
+ shape: 'circle',
+ theme: 'primary',
+ externalClass: `${prefix}-fab__button`,
+};
let Fab = class Fab extends SuperComponent {
constructor() {
super(...arguments);
+ this.behaviors = [useCustomNavbar];
this.properties = props;
this.externalClasses = [`class`, `${prefix}-class`, `${prefix}-class-button`];
this.data = {
prefix,
classPrefix: name,
- baseButtonProps: {
- size: 'large',
- shape: 'circle',
- theme: 'primary',
- },
+ buttonData: baseButtonProps,
+ moveStyle: null,
};
this.observers = {
- text(val) {
- if (val) {
- this.setData({
- baseButtonProps: {
- shape: 'round',
- },
- });
- }
+ 'buttonProps.**, icon, text, ariaLabel'() {
+ var _a;
+ this.setData({
+ buttonData: Object.assign(Object.assign(Object.assign(Object.assign({}, baseButtonProps), { shape: this.properties.text ? 'round' : 'circle', icon: this.properties.icon }), this.properties.buttonProps), { content: this.properties.text, ariaLabel: this.properties.ariaLabel }),
+ }, (_a = this.computedSize) === null || _a === void 0 ? void 0 : _a.bind(this));
},
};
this.methods = {
onTplButtonTap(e) {
this.triggerEvent('click', e);
},
+ onMove(e) {
+ const { distanceTop } = this.data;
+ const { x, y, rect } = e.detail;
+ const maxX = systemInfo.windowWidth - rect.width;
+ const maxY = systemInfo.windowHeight - distanceTop - rect.height;
+ const right = Math.max(0, Math.min(x, maxX));
+ const bottom = Math.max(0, Math.min(y, maxY));
+ this.setData({
+ moveStyle: `right: ${right}px; bottom: ${bottom}px;`,
+ });
+ },
+ computedSize() {
+ if (!this.properties.draggable)
+ return;
+ const insChild = this.selectComponent('#draggable');
+ insChild.computedRect();
+ },
};
}
};
--
Gitblit v1.9.3