@neatui/vue 1.2.16 → 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
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script setup lang="ts">
|
|
27
|
-
import { ref, watch, computed, onMounted, PropType } from 'vue';
|
|
27
|
+
import { ref, watch, computed, onMounted, PropType, nextTick } from 'vue';
|
|
28
28
|
|
|
29
29
|
const emits = defineEmits(['update:modelValue', 'click', 'blur', 'focus', 'change', 'input', 'clear']);
|
|
30
30
|
const props = defineProps({
|
|
@@ -146,17 +146,26 @@
|
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
148
|
|
|
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
|
+
};
|
|
159
|
+
|
|
149
160
|
const mv: any = ref(props.modelValue);
|
|
150
161
|
watch(
|
|
151
162
|
() => props.modelValue,
|
|
152
163
|
(v: any) => {
|
|
153
|
-
console.log(149, v);
|
|
154
164
|
mv.value = v;
|
|
155
165
|
},
|
|
156
166
|
{ deep: true, immediate: true }
|
|
157
167
|
);
|
|
158
|
-
|
|
159
|
-
// const rows = ref(1);
|
|
168
|
+
|
|
160
169
|
watch(
|
|
161
170
|
() => mv.value,
|
|
162
171
|
(v: any) => {
|
|
@@ -168,10 +177,7 @@
|
|
|
168
177
|
emits('update:modelValue', value);
|
|
169
178
|
|
|
170
179
|
// 自动高度
|
|
171
|
-
|
|
172
|
-
el.value.style.height = 'auto';
|
|
173
|
-
el.value.style.height = el.value.scrollHeight + 'px';
|
|
174
|
-
}
|
|
180
|
+
fAutoHeight();
|
|
175
181
|
},
|
|
176
182
|
{ deep: true }
|
|
177
183
|
);
|
|
@@ -180,5 +186,7 @@
|
|
|
180
186
|
setTimeout(() => {
|
|
181
187
|
ready.value = 1;
|
|
182
188
|
}, 300);
|
|
189
|
+
// 自动高度
|
|
190
|
+
fAutoHeight();
|
|
183
191
|
});
|
|
184
192
|
</script>
|