首页
关于
归档
留言板
友链
工具
更多
壁纸
视频
Search
1
TypeError: Cannot read properties of undefined (reading 'map')
2,127 阅读
2
fail api scope is not declared in the privacy agreement
1,609 阅读
3
el-input自动获取焦点(element-ui)
884 阅读
4
组件封装时判断slot是否存在
833 阅读
5
vscode代码切换大小写的教程
750 阅读
小程序
其他
服务器
开发
Vue
uni-app
React
登录
Search
标签搜索
VUE
javascript
小程序
react
wxapp
uni-app
vue3
HTML
CSS
富文本
npm
Vuex
GIT
Element-UI
Linux
上传图片
cookie
localStorage
sessionStorage
内网穿透
Chris
累计撰写
107
篇文章
累计收到
6
条评论
首页
栏目
小程序
其他
服务器
开发
Vue
uni-app
React
页面
关于
归档
留言板
友链
工具
壁纸
视频
搜索到
5
篇与
uni-app
的结果
2022-06-30
uniapp配置跨域
配置manifest.json 见详情
2022年06月30日
102 阅读
0 评论
0 点赞
2021-10-28
uniapp 下拉刷新和页面滚动冲突问题
uniapp 下拉刷新和页面滚动冲突问题在页面滚动区域加 @touchmove.stop @touch.stop 即可
2021年10月28日
241 阅读
0 评论
0 点赞
2021-08-06
uni-app条件编译:#ifdef #ifndef #endif
uni-app条件编译:#ifdef #ifndef #endif {card-describe title="语法:"}// #ifdef %PLATFORM% 这些代码只在该平台编译 // #endif#ifdef : if defined 仅在某个平台编译 #ifndef : if not defined 在除里该平台的其他编译 #endif : end if 结束条件编译 %PLATFORM% 需要编译的平台,上面的MP就是各个小程序的意思{/card-describe}uni-app支持的各个平台值平台参考文档APP-PLUS5+AppHTML5+ 规范APP-PLUS-NVUE5+App nvueWeex 规范H5H5 MP-WEIXIN微信小程序微信小程序MP-ALIPAY支付宝小程序支付宝小程序MP-BAIDU百度小程序百度小程序MP-TOUTIAO头条小程序头条小程序MP-QQQQ小程序(目前仅cli版支持)MP微信小程序/支付宝小程序/百度小程序/头条小程序/QQ小程序 转载自:https://www.cnblogs.com/shurun/p/11935451.html
2021年08月06日
235 阅读
0 评论
0 点赞
uniapp封装一个公共请求方法
1、项目更目录下新建common文件夹,再创建request.js文件2、打开request.js文件,开始写封装的代码const request = (url = '', date = {}, titles = '加载中',type = 'POST', header = { }) => { return new Promise((resolve, reject) => { uni.showLoading({ title: titles }); uni.request({ method: type, url: url, data: date, header: header, dataType: 'json', }).then((response) => { uni.hideLoading(); uni.stopPullDownRefresh(); let [error, res] = response; if(res.data.code == 0){ uni.showToast({ title:res.data.msg, duration: 1000, success:function(){ uni.hideLoading(); } }); setTimeout(function () { resolve(res.data); }, 1000); }else if(res.data.code == 1){ uni.showToast({ title:res.data.msg.MSG, image:'../../static/public/guanbi_i.png', duration: 2000, success:function(){ uni.hideLoading(); } }); }else { uni.showToast({ title:res.data.msg, image:'../../static/public/guanbi_i.png', duration: 2000, success:function(){ uni.hideLoading(); } }); } }).catch(error => { uni.hideLoading(); uni.stopPullDownRefresh(); let [err, res] = error; reject(err) }) }); } export default request3、在main.js全局注册import request from 'common/request.js' Vue.prototype.$request = request4、页面调用this.$request('url地址', { //参数放在这里 'id':1, }).then(res => { // 打印调用成功回调 console.log('返回正确回调') })
2021年07月17日
246 阅读
0 评论
0 点赞
2021-04-13
使用uni.$emit、uni.$on 、uni.$once uni.$off进行页面间通讯
介绍看官方文档https://uniapp.dcloud.io/collocation/frame/communication?id=emit或者直接在uni-app官方网站直接搜uni.$emit*、*uni.$on、uni.$once*、*uni.$off自 HBuilderX 2.0.0 起支持 uni.$emit、 uni.$on 、 uni.$once 、uni.$off ,可以方便的进行页面的通讯 ,触发的事件都是 App 全局级别的,跨任意组件,页面,nvue,vue 等。事件详情具体如何使用呢?我们假设一个场景,进入app,是未登陆状态,需要在我的页面点击登陆,进入登陆页面进行登陆。登陆成功之后,返回到我的页面,实时显示登陆后的用户信息。{callout color="#f0ad4e"}标注内容{/callout}使用监听事件// 我的页面 onLoad(){ // 监听事件 uni.$on('login',(usnerinfo)=>{ this.usnerinfo = usnerinfo; }) }, onUnload() { // 移除监听事件 uni.$off('login'); },因为事件监听是全局的,所以使用 uni.$on ,需要使用 uni.$off 移除全局的事件监听,避免重复监听触发事件// 登陆页面 uni.$emit('login', { avatarUrl: 'https://img-cdn-qiniu.dcloud.net.cn/uploads/nav_menu/10.jpg', token: 'user123456', userName: 'unier', login: true });使用 uni.$emit 触发事件后,对应的 uni.$on 就会监听到事件触发,在回调中去执行相关的逻辑更多使用场景以上是一个简单的场景应用。而我们开发中会遇到很多页面间通讯场景,如:vue 与 nvue,nvue 与 vue 间的通讯tabbar 页面之间的通讯父页面与多级子页面间的通讯基本上述场景均可以实现,本质上就是一个页面通知另一个面我发生了变化,你需要处理一下。绝大部分页面的通讯都可以使用 uni.$emit、 uni.$on 、 uni.$once 、uni.$off 四个事件完成如果页面没有打开,将不能注册监听事件uni.$on和uni.$once一次性的事件,直接使用uni.$once监听,不需要移除附:demo本文转自: DCloud问答 ,目的在于学习与记录相关知识;如有侵犯,请联系删除
2021年04月13日
248 阅读
0 评论
0 点赞