Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
04815006
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
398
Star
3
Fork
10
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uvue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
04815006
编写于
2月 26, 2025
作者:
辛宝Otto
🥊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 限制兼容组件 emit 传递值的测试平台,补充相关注释
上级
a1a7ffe9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
43 addition
and
41 deletion
+43
-41
pages/component-instance/methods/call-method-easycom-uni-modules-composition.uvue
.../methods/call-method-easycom-uni-modules-composition.uvue
+4
-4
pages/component-instance/methods/call-method-easycom-uni-modules-options.uvue
...ance/methods/call-method-easycom-uni-modules-options.uvue
+39
-37
未找到文件。
pages/component-instance/methods/call-method-easycom-uni-modules-composition.uvue
浏览文件 @
04815006
<template>
<template>
<view>
<view>
<call-easy-method-uni-modules ref="callEasyMethod1"></call-easy-method-uni-modules>
<call-easy-method-uni-modules ref="callEasyMethod1"></call-easy-method-uni-modules>
<!-- #ifdef APP -->
<!-- #ifdef APP-ANDROID || APP-IOS -->
<!-- 在兼容组件中 ios 返回非普通对象数据,比如 Map 数据时候会被 jscore 统一处理为 object,和安卓产生了差异 -->
<!-- 测试用例用来验证返回数据特殊,安卓和其他平台无此限制 -->
<view>---</view>
<view>---</view>
<test-props id="btn1" :numList="numList" :objList='objList' @buttonclick='onButtonClick'
<test-props id="btn1" :numList="numList" :objList='objList' @buttonclick='onButtonClick'
@numListChange='numListChange' @objListChange='objListChange'
@numListChange='numListChange' @objListChange='objListChange'
...
@@ -22,7 +24,7 @@
...
@@ -22,7 +24,7 @@
import { testInOtherFile } from './call-method-easycom-uni-modules'
import { testInOtherFile } from './call-method-easycom-uni-modules'
import { ref, isProxy, isRef } from 'vue'
import { ref, isProxy, isRef } from 'vue'
// #ifdef APP
// #ifdef APP
-ANDROID || APP-IOS
import { PropsChangeEvent } from '@/uni_modules/test-props'
import { PropsChangeEvent } from '@/uni_modules/test-props'
// #endif
// #endif
...
@@ -86,7 +88,6 @@
...
@@ -86,7 +88,6 @@
const value = res['detail']!['value'] as number[]
const value = res['detail']!['value'] as number[]
const isArray = Array.isArray(value)
const isArray = Array.isArray(value)
const isLengthGt0 = value.length > 0
const isLengthGt0 = value.length > 0
console.log('is array',isArray,'is length>0',isLengthGt0,'res',isArray && isLengthGt0);
isNumListValid.value = isArray && isLengthGt0
isNumListValid.value = isArray && isLengthGt0
}
}
// #endif
// #endif
...
@@ -106,7 +107,6 @@
...
@@ -106,7 +107,6 @@
const value = res['detail']!['value'] as any[]
const value = res['detail']!['value'] as any[]
const isArray = Array.isArray(value)
const isArray = Array.isArray(value)
const isLengthGt0 = value.length > 0
const isLengthGt0 = value.length > 0
console.log('is array',isArray,'is length>0',isLengthGt0,'res',isArray && isLengthGt0);
isObjListValid.value = isArray && isLengthGt0
isObjListValid.value = isArray && isLengthGt0
}
}
// #endif
// #endif
...
...
pages/component-instance/methods/call-method-easycom-uni-modules-options.uvue
浏览文件 @
04815006
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
<view>
<view>
<call-easy-method-uni-modules ref="callEasyMethod1"></call-easy-method-uni-modules>
<call-easy-method-uni-modules ref="callEasyMethod1"></call-easy-method-uni-modules>
<!-- #ifdef APP -->
<!-- #ifdef APP-IOS || APP-ANDROID -->
<!-- 在兼容组件中 ios 返回非普通对象数据,比如 Map 数据时候会被 jscore 统一处理为 object,和安卓产生了差异 -->
<!-- 测试用例用来验证返回数据特殊,安卓和其他平台无此限制 -->
<view>---</view>
<view>---</view>
<test-props id="btn1" :numList="numList" :objList='objList' @buttonclick='onButtonClick'
<test-props id="btn1" :numList="numList" :objList='objList' @buttonclick='onButtonClick'
@numListChange='numListChange' @objListChange='objListChange'
@numListChange='numListChange' @objListChange='objListChange'
...
@@ -93,43 +95,43 @@
...
@@ -93,43 +95,43 @@
// #ifdef APP-ANDROID
// #ifdef APP-ANDROID
numListChange(res : Map<string, Map<string, any>>) {
numListChange(res : Map<string, Map<string, any>>) {
const value = res['detail']!['value'] as number[]
const value = res['detail']!['value'] as number[]
const isArray = Array.isArray(value)
const isArray = Array.isArray(value)
const isLengthGt0 = value.length > 0
const isLengthGt0 = value.length > 0
this.isNumListValid = isArray && isLengthGt0
this.isNumListValid = isArray && isLengthGt0
},
},
// #endif
// #endif
// #ifdef APP-IOS
// #ifdef APP-IOS
numListChange(res : any) {
numListChange(res : any) {
const value = res['detail']!['value'] as number[]
const value = res['detail']!['value'] as number[]
const isArray = Array.isArray(value)
const isArray = Array.isArray(value)
const isLengthGt0 = value.length > 0
const isLengthGt0 = value.length > 0
this.isNumListValid = isArray && isLengthGt0
this.isNumListValid = isArray && isLengthGt0
},
},
// #endif
// #endif
// #ifdef APP-ANDROID
// #ifdef APP-ANDROID
objListChange(res : Map<string, Map<string, any>>) {
objListChange(res : Map<string, Map<string, any>>) {
const value = res['detail']!['value'] as number[]
const value = res['detail']!['value'] as number[]
const isArray = Array.isArray(value)
const isArray = Array.isArray(value)
const isLengthGt0 = value.length > 0
const isLengthGt0 = value.length > 0
this.isObjListValid = isArray && isLengthGt0
this.isObjListValid = isArray && isLengthGt0
},
},
// #endif
// #endif
// #ifdef APP-IOS
// #ifdef APP-IOS
objListChange(res : any) {
objListChange(res : any) {
const value = res['detail']!['value'] as number[]
const value = res['detail']!['value'] as number[]
const isArray = Array.isArray(value)
const isArray = Array.isArray(value)
const isLengthGt0 = value.length > 0
const isLengthGt0 = value.length > 0
this.isObjListValid = isArray && isLengthGt0
this.isObjListValid = isArray && isLengthGt0
},
},
// #endif
// #endif
onButtonClick() {
onButtonClick() {
// 改变 props: 观察 props 返回值为非响应式值
// 改变 props: 观察 props 返回值为非响应式值
console.log('button click');
console.log('button click');
this.numList = [3, 2, 1]
this.numList = [3, 2, 1]
this.objList = [{ id: '3' }, { id: '4' }]
this.objList = [{ id: '3' }, { id: '4' }]
}
}
}
}
}
}
</script>
</script>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录