fix: 修复 InputNumber 组件宽度在表单中不占满的问题

master^2
xingyu4j 2026-05-18 16:28:19 +08:00
parent 9bb2026b4d
commit a1081bf7a6
5 changed files with 23 additions and 13 deletions

View File

@ -131,8 +131,8 @@ const PreviewGroup = defineAsyncComponent(() =>
import('ant-design-vue/es/image').then((res) => res.ImagePreviewGroup), import('ant-design-vue/es/image').then((res) => res.ImagePreviewGroup),
); );
const withDefaultPlaceholder = <T extends Component>( const withDefaultPlaceholder = (
component: T, component: Component,
type: 'input' | 'select', type: 'input' | 'select',
componentProps: Recordable<any> = {}, componentProps: Recordable<any> = {},
) => { ) => {
@ -702,7 +702,9 @@ async function initComponentAdapter() {
modelValueProp: 'value', modelValueProp: 'value',
}), }),
Input: withDefaultPlaceholder(Input, 'input'), Input: withDefaultPlaceholder(Input, 'input'),
InputNumber: withDefaultPlaceholder(InputNumber, 'input'), InputNumber: withDefaultPlaceholder(InputNumber, 'input', {
style: { width: '100%' },
}),
InputPassword: withDefaultPlaceholder(InputPassword, 'input'), InputPassword: withDefaultPlaceholder(InputPassword, 'input'),
Mentions: withDefaultPlaceholder(Mentions, 'input'), Mentions: withDefaultPlaceholder(Mentions, 'input'),
// 自定义主要按钮 // 自定义主要按钮

View File

@ -633,7 +633,9 @@ async function initComponentAdapter() {
modelValueProp: 'value', modelValueProp: 'value',
}), }),
Input: withDefaultPlaceholder(Input, 'input'), Input: withDefaultPlaceholder(Input, 'input'),
InputNumber: withDefaultPlaceholder(InputNumber, 'input'), InputNumber: withDefaultPlaceholder(InputNumber, 'input', {
style: { width: '100%' },
}),
InputPassword: withDefaultPlaceholder(InputPassword, 'input'), InputPassword: withDefaultPlaceholder(InputPassword, 'input'),
Mentions: withDefaultPlaceholder(Mentions, 'input'), Mentions: withDefaultPlaceholder(Mentions, 'input'),
// 自定义主要按钮 // 自定义主要按钮

View File

@ -141,8 +141,8 @@ const ElUpload = defineAsyncComponent(() =>
]).then(([res]) => res.ElUpload), ]).then(([res]) => res.ElUpload),
); );
const withDefaultPlaceholder = <T extends Component>( const withDefaultPlaceholder = (
component: T, component: Component,
type: 'input' | 'select', type: 'input' | 'select',
componentProps: Recordable<any> = {}, componentProps: Recordable<any> = {},
) => { ) => {
@ -284,7 +284,9 @@ async function initComponentAdapter() {
inputComponent: ElInput, inputComponent: ElInput,
}), }),
Input: withDefaultPlaceholder(ElInput, 'input'), Input: withDefaultPlaceholder(ElInput, 'input'),
InputNumber: withDefaultPlaceholder(ElInputNumber, 'input'), InputNumber: withDefaultPlaceholder(ElInputNumber, 'input', {
style: { width: '100%' },
}),
RadioGroup: (props, { attrs, slots }) => { RadioGroup: (props, { attrs, slots }) => {
let defaultSlot; let defaultSlot;
if (Reflect.has(slots, 'default')) { if (Reflect.has(slots, 'default')) {

View File

@ -84,8 +84,8 @@ const NUpload = defineAsyncComponent(() =>
import('naive-ui/es/upload').then((res) => res.NUpload), import('naive-ui/es/upload').then((res) => res.NUpload),
); );
const withDefaultPlaceholder = <T extends Component>( const withDefaultPlaceholder = (
component: T, component: Component,
type: 'input' | 'select', type: 'input' | 'select',
componentProps: Recordable<any> = {}, componentProps: Recordable<any> = {},
) => { ) => {
@ -225,7 +225,9 @@ async function initComponentAdapter() {
inputComponent: NInput, inputComponent: NInput,
}), }),
Input: withDefaultPlaceholder(NInput, 'input'), Input: withDefaultPlaceholder(NInput, 'input'),
InputNumber: withDefaultPlaceholder(NInputNumber, 'input'), InputNumber: withDefaultPlaceholder(NInputNumber, 'input', {
style: { width: '100%' },
}),
RadioGroup: (props, { attrs, slots }) => { RadioGroup: (props, { attrs, slots }) => {
let defaultSlot; let defaultSlot;
if (Reflect.has(slots, 'default')) { if (Reflect.has(slots, 'default')) {

View File

@ -89,8 +89,8 @@ const TreeSelect = defineAsyncComponent(
); );
const Upload = defineAsyncComponent(() => import('tdesign-vue-next/es/upload')); const Upload = defineAsyncComponent(() => import('tdesign-vue-next/es/upload'));
const withDefaultPlaceholder = <T extends Component>( const withDefaultPlaceholder = (
component: T, component: Component,
type: 'input' | 'select', type: 'input' | 'select',
componentProps: Recordable<any> = {}, componentProps: Recordable<any> = {},
) => { ) => {
@ -239,7 +239,9 @@ async function initComponentAdapter() {
modelValueProp: 'value', modelValueProp: 'value',
}), }),
Input: withDefaultPlaceholder(Input, 'input'), Input: withDefaultPlaceholder(Input, 'input'),
InputNumber: withDefaultPlaceholder(InputNumber, 'input'), InputNumber: withDefaultPlaceholder(InputNumber, 'input', {
style: { width: '100%' },
}),
// InputPassword: withDefaultPlaceholder(InputPassword, 'input'), // InputPassword: withDefaultPlaceholder(InputPassword, 'input'),
// Mentions: withDefaultPlaceholder(Mentions, 'input'), // Mentions: withDefaultPlaceholder(Mentions, 'input'),
// 自定义主要按钮 // 自定义主要按钮