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

Merge branch 'dev' into alpha

......@@ -267,13 +267,13 @@ export function createApp() {
app.use(plugin2)
app.use(plugin3)
app.use(plugin4)
app.use(function (app: VueApp, componentName: string, componentInstance: CreateVueComponent) {
app.component(componentName, componentInstance)
}, 'CompForPlugin1', CompForPlugin)
app.use(function (app: VueApp, componentName: string) {
app.component(componentName, CompForPlugin)
}, 'CompForPlugin1')
app.use({
install(app: VueApp, a: string | null, b: string | null) {
app.component('CompForPlugin2', CompForPlugin as CreateVueComponent)
app.component('CompForPlugin2', CompForPlugin)
}
}, null, null)
......
......@@ -28,29 +28,14 @@ defineProps({
const attrs = useAttrs()
const hasPropsAttr = computed(():boolean => {
// #ifdef APP-ANDROID
return attrs.has('val')
// #endif
// #ifndef APP-ANDROID
return !!attrs['val']
// #endif
return attrs['val'] != null
})
const hasEmitsAttr = computed(():boolean => {
// #ifdef APP-ANDROID
return attrs.has('childClick')
// #endif
// #ifndef APP-ANDROID
return !!attrs['childClick']
// #endif
return attrs['childClick'] != null
})
const hasClassAttr = computed(():boolean => {
// #ifdef APP-ANDROID
return attrs.has('class')
// #endif
// #ifndef APP-ANDROID
return !!attrs['class']
// #endif
return attrs['class'] != null
})
</script>
......@@ -26,28 +26,13 @@ export default {
},
computed: {
hasPropsAttr(): boolean {
// #ifdef APP-ANDROID
return this.$attrs.has('val')
// #endif
// #ifndef APP-ANDROID
return !!this.$attrs['val']
// #endif
return this.$attrs['val'] != null
},
hasEmitsAttr(): boolean {
// #ifdef APP-ANDROID
return this.$attrs.has('childClick')
// #endif
// #ifndef APP-ANDROID
return !!this.$attrs['childClick']
// #endif
return this.$attrs['childClick'] != null
},
hasClassAttr(): boolean {
// #ifdef APP-ANDROID
return this.$attrs.has('class')
// #endif
// #ifndef APP-ANDROID
return !!this.$attrs['class']
// #endif
return this.$attrs['class'] != null
}
}
}
......
......@@ -30,11 +30,6 @@
})
const triggerParentFn = () => {
// #ifdef APP-ANDROID || WEB
parentNum.value = instance.$parent!.$callMethod('callMethodByChild') as number
// #endif
// #ifndef APP-ANDROID || WEB
parentNum.value = instance.$parent!['callMethodByChild']()
// #endif
}
</script>
\ No newline at end of file
......@@ -27,12 +27,7 @@
},
methods: {
triggerParentFn() {
// #ifdef APP-ANDROID || WEB
this.parentNum = this.$parent!.$callMethod('callMethodByChild') as number
// #endif
// #ifndef APP-ANDROID || WEB
this.parentNum = this.$parent!['callMethodByChild']()
// #endif
}
}
}
......
......@@ -17,12 +17,7 @@
const callMethodByChild = () : number => {
const childComponent = instance.$refs['childRef'] as ComponentPublicInstance
// #ifdef APP-ANDROID
return childComponent.$parent!.$callMethod('getNum') as number
// #endif
// #ifndef APP-ANDROID
return childComponent.$parent!['getNum']()
// #endif
}
defineExpose({
......
......@@ -23,12 +23,7 @@ export default {
},
callMethodByChild(): number {
const child = this.$refs['child'] as ComponentPublicInstance
// #ifdef APP-ANDROID
return child.$parent!.$callMethod('getNum') as number
// #endif
// #ifndef APP-ANDROID
return child.$parent!['getNum']()
// #endif
}
}
}
......
......@@ -56,10 +56,8 @@ const updateData = () => {
}
const updateReadonlyData = () => {
// #ifndef WEB
readonlyData.str = 'new readonly str'
readonlyData.num++
readonlyData.arr.push('e')
// #endif
}
</script>
......@@ -4,12 +4,7 @@
const originalVNode = h('view', { class: 'original' }, [
h('text', {}, 'Hello World'),
])
// #ifdef APP-ANDROID
const clonedVNode = cloneVNode(originalVNode, new Map<string, any | null>([['class', 'cloned']]))
// #endif
// #ifdef WEB || APP-IOS
const clonedVNode = cloneVNode(originalVNode, { class: 'cloned'})
// #endif
const clonedVNode = cloneVNode(originalVNode, { class: 'cloned' })
return h('view', { class: 'flex flex-col' }, [originalVNode, clonedVNode])
}
......
......@@ -4,12 +4,7 @@
const originalVNode = h('view', { class: 'original' }, [
h('text', {}, 'Hello World'),
])
// #ifdef APP-ANDROID
const clonedVNode = cloneVNode(originalVNode, new Map<string, any | null>([['class', 'cloned']]))
// #endif
// #ifdef WEB || APP-IOS
const clonedVNode = cloneVNode(originalVNode, { class: 'cloned'})
// #endif
const clonedVNode = cloneVNode(originalVNode, { class: 'cloned' })
return h('view', { class: 'flex flex-col' }, [originalVNode, clonedVNode])
}
......
......@@ -14,12 +14,7 @@
<script setup lang="uts">
const isVNodeVNode = ref(false)
const isVNodeString = ref(false)
// #ifdef APP-ANDROID
const vnode = h('text', new Map<string, any | null>(), 'Hello World')
// #endif
// #ifndef APP-ANDROID
const vnode = h('text', {}, 'Hello World')
// #endif
isVNodeVNode.value = isVNode(vnode)
isVNodeString.value = isVNode('abc')
</script>
</script>
\ No newline at end of file
......@@ -12,23 +12,17 @@
</template>
<script lang="uts">
export default {
data(){
return {
isVNodeVNode: false,
isVNodeString: false
export default {
data() {
return {
isVNodeVNode: false,
isVNodeString: false
}
},
onLoad() {
const vnode = h('text', {}, 'Hello World')
this.isVNodeVNode = isVNode(vnode)
this.isVNodeString = isVNode('abc')
}
},
onLoad(){
// TODO: 确认 android 端与其他端差异
// #ifdef APP-ANDROID
const vnode = h('text', new Map<string, any | null>(), 'Hello World')
// #endif
// #ifndef APP-ANDROID
const vnode = h('text', {}, 'Hello World')
// #endif
this.isVNodeVNode = isVNode(vnode)
this.isVNodeString = isVNode('abc')
}
}
</script>
</script>
\ No newline at end of file
......@@ -15,13 +15,6 @@
<script setup lang="uts">
type PropFn = () => string
// TODO: 确认 android 与 web & ios 差异
// #ifdef APP-ANDROID
const propA = new Map<string, any | null>([['class', 'foo'], ['onClick', () : string => 'propA click res']])
const propB = new Map<string, any | null>([['class', { bar: true }], ['onClick', () : string => 'propB click res']])
const mergedProps = ref(new Map<string, any | null>())
// #endif
// #ifndef APP-ANDROID
const propA = {
class: 'foo',
onClick: () : string => 'propA click res'
......@@ -31,11 +24,10 @@
onClick: () : string => 'propB click res'
}
const mergedProps = ref({})
// #endif
const propFnResList = ref<string[]>([])
mergedProps.value = mergeProps(propA, propB)
const triggerMergedClick = () => {
(mergedProps.value['onClick'] as PropFn[]).forEach(fn => { propFnResList.value.push(fn()) })
}
......
......@@ -17,13 +17,6 @@
export default {
data() {
return {
// TODO: 确认 android 与 web & ios 差异
// #ifdef APP-ANDROID
propA: new Map<string, any | null>([['class', 'foo'], ['onClick', () : string => 'propA click res']]),
propB: new Map<string, any | null>([['class', { bar: true }], ['onClick', () : string => 'propB click res']]),
mergedProps: new Map<string, any | null>(),
// #endif
// #ifndef APP-ANDROID
propA: {
class: 'foo',
onClick: () : string => 'propA click res'
......@@ -33,7 +26,6 @@
onClick: () : string => 'propB click res'
},
mergedProps: {},
// #endif
propFnResList: [] as string[],
}
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册