@neatui/vue 1.2.15 → 1.2.17
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.
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
<div v-if="ready" :ui-form-tips="state.ontips">{{ state.tips }}</div>
|
|
7
7
|
<slot>
|
|
8
8
|
<textarea
|
|
9
|
+
ref="el"
|
|
9
10
|
:rows="rows"
|
|
10
11
|
v-model="mv"
|
|
11
12
|
:type="type"
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
</template>
|
|
24
25
|
|
|
25
26
|
<script setup lang="ts">
|
|
26
|
-
import { ref, watch, computed, onMounted, PropType } from 'vue';
|
|
27
|
+
import { ref, watch, computed, onMounted, PropType, nextTick } from 'vue';
|
|
27
28
|
|
|
28
29
|
const emits = defineEmits(['update:modelValue', 'click', 'blur', 'focus', 'change', 'input', 'clear']);
|
|
29
30
|
const props = defineProps({
|
|
@@ -61,6 +62,11 @@
|
|
|
61
62
|
type: Number,
|
|
62
63
|
default: null
|
|
63
64
|
},
|
|
65
|
+
// 最小长度
|
|
66
|
+
autoHeight: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false
|
|
69
|
+
},
|
|
64
70
|
// 是否禁用
|
|
65
71
|
disabled: {
|
|
66
72
|
type: Boolean,
|
|
@@ -140,16 +146,26 @@
|
|
|
140
146
|
}
|
|
141
147
|
});
|
|
142
148
|
|
|
143
|
-
|
|
149
|
+
// 自动高度
|
|
150
|
+
const el: any = ref(null);
|
|
151
|
+
const fAutoHeight = () => {
|
|
152
|
+
nextTick(() => {
|
|
153
|
+
if (props.autoHeight) {
|
|
154
|
+
el.value.style.height = 'auto';
|
|
155
|
+
el.value.style.height = Math.ceil(el.value.scrollHeight) + 'px';
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
};
|
|
144
159
|
|
|
160
|
+
const mv: any = ref(props.modelValue);
|
|
145
161
|
watch(
|
|
146
162
|
() => props.modelValue,
|
|
147
163
|
(v: any) => {
|
|
148
|
-
console.log(149, v);
|
|
149
164
|
mv.value = v;
|
|
150
165
|
},
|
|
151
166
|
{ deep: true, immediate: true }
|
|
152
167
|
);
|
|
168
|
+
|
|
153
169
|
watch(
|
|
154
170
|
() => mv.value,
|
|
155
171
|
(v: any) => {
|
|
@@ -159,6 +175,9 @@
|
|
|
159
175
|
mv.value = value;
|
|
160
176
|
}
|
|
161
177
|
emits('update:modelValue', value);
|
|
178
|
+
|
|
179
|
+
// 自动高度
|
|
180
|
+
fAutoHeight();
|
|
162
181
|
},
|
|
163
182
|
{ deep: true }
|
|
164
183
|
);
|
|
@@ -167,5 +186,7 @@
|
|
|
167
186
|
setTimeout(() => {
|
|
168
187
|
ready.value = 1;
|
|
169
188
|
}, 300);
|
|
189
|
+
// 自动高度
|
|
190
|
+
fAutoHeight();
|
|
170
191
|
});
|
|
171
192
|
</script>
|