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/input/input.js | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/miniprogram_npm/tdesign-miniprogram/input/input.js b/miniprogram_npm/tdesign-miniprogram/input/input.js
index c926018..3780064 100644
--- a/miniprogram_npm/tdesign-miniprogram/input/input.js
+++ b/miniprogram_npm/tdesign-miniprogram/input/input.js
@@ -7,7 +7,7 @@
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
-import { getCharacterLength, calcIcon } from '../common/utils';
+import { getCharacterLength, calcIcon, isDef } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-input`;
let Input = class Input extends SuperComponent {
@@ -32,11 +32,13 @@
prefix,
classPrefix: name,
classBasePrefix: prefix,
+ showClearIcon: true,
};
this.lifetimes = {
ready() {
- const { value } = this.properties;
- this.updateValue(value == null ? '' : value);
+ var _a;
+ const { value, defaultValue } = this.properties;
+ this.updateValue((_a = value !== null && value !== void 0 ? value : defaultValue) !== null && _a !== void 0 ? _a : '');
},
};
this.observers = {
@@ -55,6 +57,9 @@
_clearIcon: calcIcon(v, 'close-circle-filled'),
});
},
+ clearTrigger() {
+ this.updateClearIconVisible();
+ },
};
this.methods = {
updateValue(value) {
@@ -66,7 +71,7 @@
count: length,
});
}
- else if (maxlength > 0 && !Number.isNaN(maxlength)) {
+ else if (maxlength && maxlength > 0 && !Number.isNaN(maxlength)) {
const { length, characters } = getCharacterLength('maxlength', value, maxlength);
this.setData({
value: characters,
@@ -76,9 +81,13 @@
else {
this.setData({
value,
- count: value ? String(value).length : 0,
+ count: isDef(value) ? String(value).length : 0,
});
}
+ },
+ updateClearIconVisible(value = false) {
+ const { clearTrigger } = this.properties;
+ this.setData({ showClearIcon: value || clearTrigger === 'always' });
},
onInput(e) {
const { value, cursor, keyCode } = e.detail;
@@ -86,9 +95,11 @@
this.triggerEvent('change', { value: this.data.value, cursor, keyCode });
},
onFocus(e) {
+ this.updateClearIconVisible(true);
this.triggerEvent('focus', e.detail);
},
onBlur(e) {
+ this.updateClearIconVisible();
this.triggerEvent('blur', e.detail);
},
onConfirm(e) {
--
Gitblit v1.9.3