1
- import {
2
- computed ,
3
- defineComponent ,
4
- h ,
5
- mergeProps ,
6
- onMounted ,
7
- reactive ,
8
- ref ,
9
- resolveComponent ,
10
- } from 'vue'
1
+ import { computed , defineComponent , h , mergeProps , resolveComponent } from 'vue'
11
2
import { isFunction , isObject , isString } from '../utils/index'
12
3
import { formComponentProps } from './props'
13
4
import type { Slot } from 'vue'
@@ -23,18 +14,16 @@ interface TargetEvent {
23
14
export default defineComponent ( {
24
15
name : 'ProFormComponent' ,
25
16
props : formComponentProps ,
26
- setup ( props , { attrs, emit, expose } ) {
17
+ setup ( props , { attrs, emit } ) {
27
18
const nativeComponents = [ 'input' , 'textarea' , 'select' ]
28
- const componentRef = ref < StringObject > ( { } )
29
- const componentExpose = reactive < StringObject > ( { } )
30
19
31
20
const type = computed ( ( ) => {
32
21
return isString ( props . is ) && ! nativeComponents . includes ( props . is )
33
22
? resolveComponent ( props . is )
34
23
: props . is !
35
24
} )
36
25
const componentProps = computed ( ( ) => {
37
- const _props : StringObject = mergeProps ( { ref : componentRef } , attrs )
26
+ const _props : StringObject = mergeProps ( { ref : props . _ref } , attrs )
38
27
39
28
if ( isString ( props . is ) && nativeComponents . includes ( props . is ) ) {
40
29
if (
@@ -73,12 +62,6 @@ export default defineComponent({
73
62
}
74
63
} )
75
64
76
- onMounted ( ( ) => {
77
- Object . assign ( componentExpose , componentRef . value )
78
- } )
79
-
80
- expose ( componentExpose )
81
-
82
65
return ( ) => h ( type . value , componentProps . value , children . value )
83
66
} ,
84
67
} )
0 commit comments