Skip to content

Commit 75ec7ce

Browse files
committed
fix: previewText input title bug
1 parent 87a1314 commit 75ec7ce

File tree

1 file changed

+40
-35
lines changed
  • packages/components/src/preview-text

1 file changed

+40
-35
lines changed

packages/components/src/preview-text/index.ts

+40-35
Original file line numberDiff line numberDiff line change
@@ -32,43 +32,48 @@ export const usePlaceholder = (value?: Ref<any>) => {
3232
return placeholder
3333
}
3434

35-
const Input = defineComponent({
36-
name: 'FPreviewTextInput',
37-
props: ['value'],
38-
setup(props, { attrs }) {
39-
const value = toRef(props, 'value')
40-
const placeholder = usePlaceholder(value)
41-
return () => {
42-
return h(
43-
'div',
44-
{
45-
class: [prefixCls, `${stylePrefix}-preview-input`],
46-
style: attrs.style,
47-
attrs: {
48-
...attrs,
49-
disabled: false,
35+
const Input = observer(
36+
defineComponent({
37+
name: 'FPreviewTextInput',
38+
props: ['value'],
39+
setup(props, { attrs }) {
40+
const fieldRef = useField<Field>()
41+
const field = fieldRef.value
42+
const value = toRef(props, 'value')
43+
const placeholder = usePlaceholder(value)
44+
return () => {
45+
return h(
46+
'div',
47+
{
48+
class: [prefixCls, `${stylePrefix}-preview-input`],
49+
style: attrs.style,
50+
attrs: {
51+
...attrs,
52+
...props,
53+
disabled: false,
54+
},
5055
},
51-
},
52-
{
53-
default: () => [
54-
[
55-
h(
56-
'span',
57-
{
58-
class: [`${stylePrefix}-preview-input-title`],
59-
},
60-
{
61-
default: () => [attrs.label],
62-
}
63-
),
56+
{
57+
default: () => [
58+
[
59+
h(
60+
'span',
61+
{
62+
class: [`${stylePrefix}-preview-input-title`],
63+
},
64+
{
65+
default: () => [field.title],
66+
}
67+
),
68+
],
69+
placeholder.value,
6470
],
65-
placeholder.value,
66-
],
67-
}
68-
)
69-
}
70-
},
71-
})
71+
}
72+
)
73+
}
74+
},
75+
})
76+
)
7277

7378
const Checkbox = observer(
7479
defineComponent({

0 commit comments

Comments
 (0)