Skip to content

Commit

Permalink
Revert "feat(uni-app-x web): 去除form组件多余dom节点"
Browse files Browse the repository at this point in the history
This reverts commit f4ee0ce.
  • Loading branch information
Wangyaqi committed May 6, 2024
1 parent 6b17ae1 commit e523c6f
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions packages/uni-components/src/vue/form/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { onMounted, provide, ref } from 'vue'
import { provide, ref, onMounted } from 'vue'
import {
type CustomEventTrigger,
type EmitEvent,
CustomEventTrigger,
EmitEvent,
useCustomEvent,
} from '@dcloudio/uni-components'
import { PolySymbol } from '@dcloudio/uni-core'
Expand Down Expand Up @@ -35,17 +35,12 @@ export default /*#__PURE__*/ defineBuiltInComponent({
setup(_props, { slots, emit }) {
const rootRef = ref<HTMLElement | null>(null)
provideForm(useCustomEvent<EmitEvent<typeof emit>>(rootRef, emit))
if (__X__ && !__NODE_JS__) {
onMounted(() => {
const rootElement = rootRef.value as UniFormElement
rootElement.attachVmProps(_props)
})
}
if (__X__) {
return () => (
<uni-form ref={rootRef}>{slots.default && slots.default()}</uni-form>
)
}
//#if _X_ && !_NODE_JS_
onMounted(() => {
const rootElement = rootRef.value as UniFormElement
rootElement.attachVmProps(_props)
})
//#endif
return () => (
<uni-form ref={rootRef}>
<span>{slots.default && slots.default()}</span>
Expand Down

0 comments on commit e523c6f

Please sign in to comment.