easy3wui 1.5.46-beta1 → 1.5.46-beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -50,7 +50,21 @@ var Easy3wGridTextArea = function (_Component) {
|
|
|
50
50
|
args[_key] = arguments[_key];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.
|
|
53
|
+
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.touchSetHeight = function () {
|
|
54
|
+
// 获取textarea元素
|
|
55
|
+
var textarea = document.getElementById('myTextarea');
|
|
56
|
+
console.log('kkkkkkkkkkkkkkkkkkkkkk', textarea);
|
|
57
|
+
if (textarea) {
|
|
58
|
+
// 监听输入事件
|
|
59
|
+
textarea.addEventListener('input', function () {
|
|
60
|
+
// 移除滚动条,以便正确计算内容高度
|
|
61
|
+
this.style.height = 'auto';
|
|
62
|
+
this.style.height = this.scrollHeight + 'px';
|
|
63
|
+
});
|
|
64
|
+
// 初始时设置一次高度,确保页面加载时textarea高度正确
|
|
65
|
+
textarea.style.height = textarea.scrollHeight + 'px';
|
|
66
|
+
}
|
|
67
|
+
}, _this.touchTransform = function (value) {
|
|
54
68
|
var strValue = value;
|
|
55
69
|
if (typeof value === 'number') {
|
|
56
70
|
strValue = String(value);
|
|
@@ -58,6 +72,10 @@ var Easy3wGridTextArea = function (_Component) {
|
|
|
58
72
|
return strValue;
|
|
59
73
|
}, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret);
|
|
60
74
|
}
|
|
75
|
+
|
|
76
|
+
Easy3wGridTextArea.prototype.componentDidMount = function componentDidMount() {
|
|
77
|
+
this.touchSetHeight();
|
|
78
|
+
};
|
|
61
79
|
// 检验长度前转换字段值为字符串
|
|
62
80
|
|
|
63
81
|
|
|
@@ -78,9 +96,9 @@ var Easy3wGridTextArea = function (_Component) {
|
|
|
78
96
|
rows = _ref.rows;
|
|
79
97
|
|
|
80
98
|
var defaultMaxLength = 2000;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
99
|
+
if (!rows) {
|
|
100
|
+
cmptPros = (0, _extends3['default'])({ autosize: { minRows: 2, maxRows: 9999 } }, cmptPros);
|
|
101
|
+
}
|
|
84
102
|
var rules = [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }, { max: maxLength || defaultMaxLength, message: '\u5F55\u5165\u6587\u5B57\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7' + (maxLength || defaultMaxLength), transform: this.touchTransform }];
|
|
85
103
|
if (disabled) {
|
|
86
104
|
rules.pop();
|