界面
<!-- index.wxml -->
<navigation-bar title="文件" back="{{true}}" color="black" background="#FFF"></navigation-bar>
<view class="container">
<button bindtap="handleChooseFile">选择聊天记录中的文件</button>
<button bindtap="handleChooseImg">本地图片</button>
<button bindtap="handleChooseVideo">本地视频</button>
<button bindtap="">选择聊天记录历史</button>
</view>TS
// index.mts
import { chooseMessageFile } from './choose/chooseMessageFile'; // 引入上面定义的函数
import { chooseImage } from './choose/chooseImage';
import { chooseVideo } from './choose/chooseVideo';
import { getChatHistory } from './choose/chatHistory';
Page({
data: {
// 组件的数据部分
},
// 组件的方法部分
handleChooseFile: function () {
chooseMessageFile(); // 调用选择文件的函数
},
handleChooseImg: function () {
chooseImage(); // 调用选择文件的函数
},
handleChooseVideo: function () {
chooseVideo(); // 调用选择文件的函数
},
handleChoosehistory: function () {
getChatHistory(); // 调用选择文件的函数
},
});less
/* index.wxss */
.container {
padding: 20px;
button {
width: 80vw;
margin-top: 20px;
}
}