提交 5df36a83 编写于 作者: 雪洛's avatar 雪洛

fix(uni-app-x web): 移除ssr时对HTMLElement的引用

上级 378fec45
......@@ -73,10 +73,12 @@ export default /*#__PURE__*/ defineBuiltInComponent({
name: 'Switch',
props,
emits: ['change'],
//#if _X_ && !_NODE_JS_
rootElement: {
name: 'uni-switch',
class: UniSwitchElement,
},
//#endif
setup(props, { emit }) {
const rootRef = ref<HTMLElement | null>(null)
const switchChecked = ref(props.checked)
......@@ -117,6 +119,8 @@ export default /*#__PURE__*/ defineBuiltInComponent({
checkedCache.value = val
}
)
//#if _X_ && !_NODE_JS_
onMounted(() => {
const rootElement = rootRef.value as UniSwitchElement
Object.defineProperty(rootElement, 'checked', {
......@@ -129,6 +133,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({
})
rootElement.attachVmProps(props)
})
//#endif
return () => {
const {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册