提交 6e3ae8b1 编写于 作者: M mahaifeng

添加uni-arrayBufferToBase64,base64ToArrayBuffer 测试用例

上级 fc91c2a6
<template>
<view>
<view class="text-area">
<button style="margin-top: 10px;" type="primary" @tap="arrayBufferToBase64"> arrayBufferToBase64 </button>
<button style="margin-top: 10px;" type="primary" @tap="base64ToArrayBuffer"> base64ToArrayBuffer </button>
<button class="btnstyle" type="primary" @tap="arrayBufferToBase64"> arrayBufferToBase64 </button>
<button class="btnstyle" type="primary" @tap="base64ToArrayBuffer"> base64ToArrayBuffer </button>
</view>
</view>
</template>
......@@ -26,6 +26,9 @@
const base64 = uni.arrayBufferToBase64(arraybuffer)
console.log(base64) //CxYh
this.arrayBufferToBase64Res = base64
uni.showToast({
title:this.arrayBufferToBase64Res
})
},
base64ToArrayBuffer() {
const base64 = 'CxYh'
......@@ -33,6 +36,9 @@
const uint8 = new Uint8Array(arrayBuffer)
console.log(uint8.toString())//11, 22, 33
this.base64ToArrayBufferRes = uint8.toString()
uni.showToast({
title:this.base64ToArrayBufferRes
})
}
}
......@@ -51,4 +57,8 @@
color: #8f8f94;
text-align: center;
}
.btnstyle {
margin: 4px;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册