mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
feat(design): input支持textarea rows
This commit is contained in:
parent
44efb3a967
commit
63d8c98822
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<component
|
<component
|
||||||
|
ref="instance"
|
||||||
class="tmagic-design-input"
|
class="tmagic-design-input"
|
||||||
:is="uiComponent"
|
:is="uiComponent"
|
||||||
v-bind="uiProps"
|
v-bind="uiProps"
|
||||||
@ -23,7 +24,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
import { getConfig } from './config';
|
import { getConfig } from './config';
|
||||||
import type { InputProps } from './types';
|
import type { InputProps } from './types';
|
||||||
@ -42,6 +43,8 @@ const uiProps = computed(() => ui?.props(props) || props);
|
|||||||
|
|
||||||
const emit = defineEmits(['change', 'input', 'update:modelValue']);
|
const emit = defineEmits(['change', 'input', 'update:modelValue']);
|
||||||
|
|
||||||
|
const instance = ref<any>();
|
||||||
|
|
||||||
const changeHandler = (...args: any[]) => {
|
const changeHandler = (...args: any[]) => {
|
||||||
emit('change', ...args);
|
emit('change', ...args);
|
||||||
};
|
};
|
||||||
@ -53,4 +56,14 @@ const inputHandler = (...args: any[]) => {
|
|||||||
const updateModelValue = (...args: any[]) => {
|
const updateModelValue = (...args: any[]) => {
|
||||||
emit('update:modelValue', ...args);
|
emit('update:modelValue', ...args);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
instance,
|
||||||
|
getInput() {
|
||||||
|
return instance.value.input;
|
||||||
|
},
|
||||||
|
getTextarea() {
|
||||||
|
return instance.value.textarea;
|
||||||
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -181,6 +181,7 @@ export interface InputProps {
|
|||||||
clearable?: boolean;
|
clearable?: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
rows?: number;
|
||||||
type?: string;
|
type?: string;
|
||||||
size?: FieldSize;
|
size?: FieldSize;
|
||||||
}
|
}
|
||||||
@ -515,7 +516,17 @@ export interface Components {
|
|||||||
};
|
};
|
||||||
|
|
||||||
input: {
|
input: {
|
||||||
component: DefineComponent<InputProps, {}, any> | string;
|
component:
|
||||||
|
| DefineComponent<
|
||||||
|
InputProps,
|
||||||
|
{
|
||||||
|
instance: any;
|
||||||
|
getInput: () => HTMLInputElement | undefined;
|
||||||
|
getTextarea: () => HTMLTextAreaElement | undefined;
|
||||||
|
},
|
||||||
|
any
|
||||||
|
>
|
||||||
|
| string;
|
||||||
props: (props: InputProps) => InputProps;
|
props: (props: InputProps) => InputProps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user