提交 757bcf5f 编写于 作者: 杜庆泉's avatar 杜庆泉

android 增加数组转换示例

上级 4a569ef0
......@@ -24,7 +24,8 @@
clearIntervalTask,
playAssetAudio,
getMetaConfig,
quitApp
quitApp,
arrayConvert
} from "../../uni_modules/uts-advance";
export default {
......@@ -89,6 +90,9 @@
}, {
name: "退出当前应用",
function: "testQuitApp"
},{
name: "数组转换测试",
function: "testArrayConvert"
}]
},
{
......@@ -212,6 +216,15 @@
testQuitApp() {
quitApp()
},
testArrayConvert() {
let convertRet = arrayConvert()
if(convertRet){
uni.showToast({
icon: "none",
title: '数组转换成功'
});
}
},
testMetaRead() {
let ret = getMetaConfig();
uni.showToast({
......
......@@ -506,4 +506,33 @@ export class User {
}
export function arrayConvert():boolean{
let b1 = byteArrayOf(-1,2,0,3,4,5)
let c1 = UTSArray.fromNative(b1)
if(!(c1 instanceof UTSArray<Number>)){
return false
}
let b2 = longArrayOf(-1,2,0,3,4,5)
let c2 = UTSArray.fromNative(b2)
if(!(c2 instanceof UTSArray<Number>)){
return false
}
let b3 = shortArrayOf(-1,2,0,3,4,5)
let c3 = UTSArray.fromNative(b3)
if(!(c3 instanceof UTSArray<Number>)){
return false
}
let b4 = intArrayOf(-1,2,0,3,4,5)
let c4 = UTSArray.fromNative(b4)
if(!(c4 instanceof UTSArray<Number>)){
return false
}
return true
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册