提交 bfa2ad44 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

refactor(render function): 移除 vue API 导入

上级 6e761430
<script setup lang="uts">
import { cloneVNode } from 'vue'
defineOptions({
render() : VNode {
const originalVNode = h('view', { class: 'original' }, [
......
<script lang="uts">
import { cloneVNode } from 'vue'
export default {
render() : VNode {
const originalVNode = h('view', { class: 'original' }, [
......
......@@ -12,15 +12,13 @@
</template>
<script setup lang="uts">
import {isVNode} from 'vue'
const isVNodeVNode = ref(false)
const isVNodeString = ref(false)
// #ifdef APP-ANDROID
const vnode = h('text', new Map<string, any | null>(), 'Hello World')
// #ifdef APP-ANDROID
const vnode = h('text', new Map<string, any | null>(), 'Hello World')
// #endif
// #ifndef APP-ANDROID
const vnode = h('text', {}, 'Hello World')
// #ifndef APP-ANDROID
const vnode = h('text', {}, 'Hello World')
// #endif
isVNodeVNode.value = isVNode(vnode)
isVNodeString.value = isVNode('abc')
......
......@@ -12,8 +12,6 @@
</template>
<script lang="uts">
import {isVNode} from 'vue'
export default {
data(){
return {
......
......@@ -13,8 +13,6 @@
</template>
<script setup lang="uts">
import { mergeProps } from 'vue'
type PropFn = () => string
// TODO: 确认 android 与 web & ios 差异
......
......@@ -13,8 +13,6 @@
</template>
<script lang="uts">
import { mergeProps } from 'vue'
type PropFn = () => string
export default {
data() {
......
<script setup lang="uts">
import { resolveComponent } from 'vue'
defineOptions({
render() : VNode {
const CompForAppComponent = resolveComponent('CompForAppComponent')
......
<script lang="uts">
import { resolveComponent } from 'vue'
export default {
setup() {
const CompForAppComponent = resolveComponent('CompForAppComponent')
......
<script setup lang="ts">
import { withDirectives } from 'vue'
import type { DirectiveBinding } from 'vue'
defineOptions({
data() {
return {
isMounted: false
}
},
render() : VNode {
const instance = getCurrentInstance()!.proxy!
render() : VNode {
const instance = getCurrentInstance()!.proxy!
const customDirective = {
mounted(el : UniElement, binding : DirectiveBinding, vnode : VNode, prevVNode: VNode | null) {
console.log(el, binding, vnode, prevVNode)
instance.$data['isMounted'] = true
mounted(el : UniElement, binding : DirectiveBinding, vnode : VNode, prevVNode: VNode | null) {
console.log(el, binding, vnode, prevVNode)
instance.$data['isMounted'] = true
}
} as Directive
return h('view', { class: 'page' }, [
withDirectives(h('text', 'Hello World'), [[customDirective]]),
h('view', { class: 'mt-10 flex flex-row justify-between' }, [
h('text', {}, `isMounted:`),
h('text', {}, `isMounted:`),
h('text', { id: 'is-mounted' }, `${instance.$data['isMounted']}`),
])
])
......
<script lang="uts">
import { withDirectives } from 'vue'
import type { DirectiveBinding } from 'vue'
export default {
data() {
return {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册