feat: buffer
parent
f49b68f82c
commit
e02b94368a
|
@ -0,0 +1,16 @@
|
|||
// pages/API/get-network-type/get-network-type.js
|
||||
Page({
|
||||
data: {
|
||||
result: ''
|
||||
},
|
||||
testBuffer() {
|
||||
const base64 = 'CxYh'
|
||||
const arrayBuffer = wx.base64ToArrayBuffer(base64)
|
||||
console.log('call wx.base64ToArrayBuffer', arrayBuffer);
|
||||
const base64res = wx.arrayBufferToBase64(arrayBuffer)
|
||||
console.log('call wx.arrayBufferToBase64', base64res);
|
||||
this.setData({
|
||||
result: base64res
|
||||
});
|
||||
}
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"navigationBarTitleText": "获取手机网络状态"
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<!--pages/API/get-network-type/get-network-type.wxml-->
|
||||
<import src="../../common/head.wxml" />
|
||||
<import src="../../common/foot.wxml" />
|
||||
|
||||
<view class="container">
|
||||
<template is="head" data="{{title: 'getNetworkType'}}"/>
|
||||
|
||||
<view class="page-body">
|
||||
<view class="page-section">
|
||||
<view>这个按钮先调用 wx.base64ToArrayBuffer 将 base64 转换成 ArrayBuffer , 在调用 wx.arrayBufferToBase64 对象转成 Base64 字符串</view>
|
||||
<view>点击btn 如果result结果是 'CxYh' 说明调用成功</view>
|
||||
<view>result {{result}}</view>
|
||||
<view class="btn-area">
|
||||
<button type="primary" bindtap="testBuffer">test {{result}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<template is="foot" />
|
||||
</view>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/* pages/API/get-network-type/get-network-type.wxss */
|
||||
.page-body-info {
|
||||
height: 100px;
|
||||
}
|
||||
.page-body-text-network-type {
|
||||
font-size: 40px;
|
||||
font-family: -apple-system-font,Helvetica Neue,Helvetica,sans-serif;
|
||||
}
|
|
@ -6,7 +6,15 @@ Page({
|
|||
}
|
||||
},
|
||||
data: {
|
||||
list: [
|
||||
list: [{
|
||||
id: 'base',
|
||||
name: '基础',
|
||||
open: false,
|
||||
pages: [{
|
||||
zh: 'buffer',
|
||||
url: 'buffer/buffer'
|
||||
},],
|
||||
},
|
||||
{
|
||||
id: 'page',
|
||||
name: '界面',
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 872 B |
|
@ -40,7 +40,7 @@
|
|||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.14.1",
|
||||
"appid": "wx60509bbad6b495c2",
|
||||
"appid": "wx723eeedb1222c3c8",
|
||||
"projectname": "wx-api-v2",
|
||||
"debugOptions": {
|
||||
"hidedInDevtools": []
|
||||
|
|
Loading…
Reference in New Issue