首页
关于
友链
Search
1
时间戳转换
69 阅读
2
vue后台管理系统切换页面动画
59 阅读
3
移动端适配
49 阅读
4
H5+ 常用API
46 阅读
5
前端常用网站
46 阅读
默认分类
vue知识点
小程序
js
H5
Html,css
uiapp
App
移动端
登录
Search
慎独
累计撰写
16
篇文章
累计收到
0
条评论
首页
栏目
默认分类
vue知识点
小程序
js
H5
Html,css
uiapp
App
移动端
页面
关于
友链
搜索到
9
篇与
小程序
的结果
2021-12-08
uniapp预览图片
单张预览 previewImg(logourl) { let _this = this; let imgsArray = []; imgsArray[0] = logourl uni.previewImage({ current: 0, urls: imgsArray }); },多张预览imgurl:['../../static/my_apples/apples1.png','../../static/my_apples/apples2.png','../../static/my_apples/apples3.png','../../static/my_apples/apples4.png','../../static/my_apples/apples5.png','../../static/my_apples/apples6.png','../../static/my_apples/apples7.png','../../static/my_apples/apples8.png'] previewImg(index) { var that = this let imgArry = [] for (let i = 0; i < this.imgurl.length; i++) { if (that.imgurl[i] != '') { imgArry.push(that.imgurl[i]) } } uni.previewImage({ current: index, urls: imgArry, indicator: 'number', loop: true }) }
2021年12月08日
7 阅读
0 评论
2 点赞
2021-12-08
uniapp app中导出手机号码到通讯录
var that = this plus.contacts.getAddressBook(plus.contacts.ADDRESSBOOK_PHONE, (addressbook) => { console.info('获取通信录对象成功') // console.info(addressbook) plus.contacts.getAddressBook(plus.contacts.ADDRESSBOOK_PHONE, (addressbook) => { // 向通讯录中添加联系人 var contact = addressbook.create() console.info(that.shuju.length) for (let i = 0; i < that.shuju.length; i++) { console.info(i) contact.name = { givenName: that.shuju[i].company } // for(let i1=0;i1<that.that.shuju[i].telphone;i1++){ contact.phoneNumbers = [{ type: '手机', value: that.shuju[i].mobile[0], preferred: true }] // } contact.save((res4) => { console.log() uni.$showMsg('导入成功', 'success') uni.$showMsg(res4) this.$refs.popup2.hide() this.duxuan = true that.api.msg("导入成功", 1) }) } }) })
2021年12月08日
13 阅读
0 评论
2 点赞
2021-12-08
在uniapp中获取json的数据,将数据导出陈Excel的表格形式
cc(){ var that = this // this.removeObjWithArr(this.shuju1,'source_id') // var for (var i = 0; i < that.shuju1.length; i++) { var newObject = {}; newObject.company = that.shuju1[i].company; newObject.mobile = that.shuju1[i].mobile; that.newArray2.push(newObject); } console.log(this.newArray2) // console.log(this.shuju1) //要导出的json数据 // const jsonData = [{ // name: '测试数据', // phone: '123456', // email: '123@456.com' // }] const jsonData = this.newArray2 //列标题 let worksheet = "sheet1"; let str = '<tr><td>公司名称</td><td>电话</td></tr>'; //循环遍历,每行加入tr标签,每个单元格加td标签 for (let i = 0; i < jsonData.length; i++) { str += '<tr>'; for (let item in jsonData[i]) { //增加\t为了不让表格显示科学计数法或者其他格式 str += `<td>${ jsonData[i][item] + '\t'}</td>`; } str += '</tr>'; } //下载的表格模板数据 let template = `<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"> <head><!--[if gte mso 9]><xml encoding="UTF-8"><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet> <x:Name>${worksheet}</x:Name> <x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet> </x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--> </head><body><table>${str}</table></body></html>`; //下载模板 this.exportFile(template); }, exportFile(fileData, documentName = "项目Excel文件") { var that=this /* PRIVATE_DOC: 应用私有文档目录常量 PUBLIC_DOCUMENTS: 程序公用文档目录常量 */ plus.io.requestFileSystem(plus.io.PUBLIC_DOCUMENTS, function(fs) { let rootObj = fs.root; let fullPath = rootObj.fullPath; // let reader = rootObj.createReader(); // console.log(reader); // reader.readEntries((res)=>{ // console.log(res); //这里拿到了该目录下所有直接文件和目录 // },(err)=>{console.log(err);}) console.log("开始导出数据********"); // 创建文件夹 rootObj.getDirectory(documentName, { create: true }, function(dirEntry) { //获取当前的年月继续创建文件夹 let date = new Date(); let year = date.getFullYear(); let month = date.getMonth() + 1; dirEntry.getDirectory(`${year}年${month}月`, { create: true }, function(dirEntry2) { // 创建文件,防止重名 let fileName = "excel" + getUnixTime(formatDateThis(new Date())); console.log(fileName); dirEntry2.getFile(`${fileName}.xlsx`, { create: true }, function(fileEntry) { fileEntry.createWriter(function(writer) { writer.onwritestart = (e) => { uni.showLoading({ title: "正在导出", mask: true }) } // /storage/emulated/0指的就是系统路径 let pathStr = fullPath.replace("/storage/emulated/0", ""); writer.onwrite = (e) => { // 成功导出数据; uni.hideLoading(); setTimeout(() => { uni.showToast({ title: "成功导出", icon: "success" }) that.$refs.popup2.hide() that.duxuan = true that.successTip = `文件位置:${pathStr}/${documentName}/${year}年${month}月`; }, 500) }; // 写入内容; writer.write(fileData); }, function(e) { console.log(e.message); }); }); }) }); }); },
2021年12月08日
9 阅读
0 评论
3 点赞
2021-12-08
uniapp 返回上一页 触发上一页的刷新
触发上一页的更新//click事件函数 gotoPre:function(){ let pages = getCurrentPages()//页面栈 let prePage = pages[pages.length - 2]//上一页 prePage.$vm.reFresh = Math.random()//触发上一页监听器 uni.navigateBack()//返回上一页 }要返回到的页面,监听reFreshdata() { return { reFresh:"" } }, watch:{ //监听reFresh,如果有修改就执行监听器 reFresh:function(){ // 调初始化页面的接口 this.getList() console.log("页面已重新加载"); } },
2021年12月08日
11 阅读
0 评论
3 点赞
1
2