![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
uni-app
KLW75
笔记存放处,仅供参考。
展开
-
uni-app 兼容不同平台
uni-app,针对不同的平台可以写不同的代码使用 以 #ifdef 或 #ifndef 加 %PLATFORM% 开头,以 #endif 结尾。就可以控制简介:#ifdef:if defined 仅在某平台存在 #ifndef:if not defined 除了某平台均存在 %PLATFORM%:平台名称平台名称都有值 生效条件 VUE3 HBuilderX 3.2.0+详情 APP-PLUS App APP-PLUS-NVUE或APP-NVUE.转载 2022-01-19 21:34:53 · 647 阅读 · 0 评论 -
uni-app 获取页面高度等
uni-app 中使用uni.getSystemInfoSync() 来获取页面的高度 宽度,可视区域宽度与高度等信息。本意是 获取系统信息同步接口。例如获取页面高度、uni.getSystemInfoSync().screenHeighttry { const res = uni.getSystemInfoSync(); console.log(res.model); console.log(res.pixelRatio); console.log(re.原创 2022-01-10 11:27:39 · 9607 阅读 · 0 评论 -
uni-app 左上角回退的判断
左上角的回退获取,判断backto() { let routes = getCurrentPages(); // 获取当前打开过的页面路由数组 let curRoute = routes[routes.length - 1].route //获取当前页面路由 if (curRoute == 'pages/index/index') { //主页回退 exitTinyApp({ appId: '' //小程序id 退出程序 }) } els原创 2021-08-29 16:45:59 · 1104 阅读 · 0 评论 -
在uni-app生成的支付宝小程序中toast时间不能控制。(uni.showToast)
在支付宝小程序中 uni.showToast 可以显示提示,但是不能控制时间duration 控制失效。uni.showToast({title: '提交成功',duration: 2000})不使用uni的提示,使用支付宝提供的 toast 就能解决。my.showToast({content: '提交成功',duration: 2000})因为有冲突使用支付宝的toast就能控制时间了。...原创 2021-08-28 20:44:04 · 1040 阅读 · 0 评论 -
uni-app的弹窗内容
加载中uni.showLoading({ title: '加载中' });这个只有使用 uni.hideLoading();才会隐藏uni.hideLoading();页面弹窗uni.showModal({ title: '提示', content: '具体内容', cancelText: "取消", // 取消按钮的文字 confirmText: "确认", // 确认按钮文字原创 2021-08-18 20:56:40 · 327 阅读 · 0 评论 -
uni-app 路由传值与接收路由传值
路由传递值this.$Router.push({name:'index',params:2})这里的params :2 就是传递过去的值。在跳转的页面可以接收this.$Route.querythis.$Route.query 就是传递过来的值,可以打印,或者在页面中直接使用...原创 2021-08-18 20:53:37 · 1264 阅读 · 0 评论 -
uni-app回退上一步
实现 回退到上一步的操作。uni.navigateBack()原创 2021-08-18 20:49:55 · 1732 阅读 · 0 评论 -
uni-app修改页面标题
uni.setNavigationBarTitle({ title:'修改的标题具体内容' });这样可以在页面中,动态修改标题,默认的标题 在 pages.json 文件中原创 2021-08-18 20:48:02 · 1369 阅读 · 0 评论 -
uni-app 最简单的页面跳转
<navigator url="../index/index" hover-class="navigator-hover"> <button type="default">跳转到index</button> </navigator>使用navigatorurl处填写要跳转的页面,点击按钮,就会跳转了。原创 2021-08-13 16:27:01 · 400 阅读 · 0 评论 -
uni-simple-router 页面跳转 (跳转到新的页面)uni-app路由管理器
点击跳转官网专为uni-app打造的路由管理器简介路由跳转功能使用uni-simple-router 跳转到新的页面。push 跳转到普通页面,新开保留历史记录。replace 动态的导航到一个新的url,并且关闭当前页面,跳转到...原创 2021-08-02 15:47:09 · 3840 阅读 · 0 评论 -
vue中几种路由跳转的区别(this.$router.push、replace、go)
this.$router.push跳转到指定url路径history栈中添加一个记录,点击后退会返回到上一个页面(可以理解为记住了从哪里来的)this.$router.push({name: ' 路由name ', params: {传递值的名字: 传递的值}})this.$router.replace 跳转到指定url路径 没有在history栈中添加一个记录,点击后退会返回到上上页面(可以理解为没记住自己从哪儿跳转的)this.$router.go(n)向前或者向后跳转n个页面,...原创 2021-07-29 23:19:15 · 682 阅读 · 1 评论 -
vue实现多选功能(不使用插件)
uni-app开发中需要使用多选,但是插件不适用的情况下循环生成列表。页面样式中这么写<view :class="{ 选中的样式css类名:存放选中状态的数组名.includes(index)}" v-for="(item,index) in 循环的数组" :key="item.index" @click="点击事件(index)"> </view>点击事件方法内的写法。index很重要方法中这么写if (存放点击状态的数组名字.includes(in原创 2021-07-21 18:53:54 · 999 阅读 · 0 评论 -
vue 报错:TypeError: Cannot read property ‘path‘ of undefined
npm install yarn在cmd里面运行这条命令安装yarn原创 2021-07-15 18:06:56 · 4024 阅读 · 0 评论 -
uni-app 编写小程序分享
在页面的button中 需要添加上open-type="share"。<button @click="turn" open-type="share"> 立即分享</button>在页面的方法中填写注意不是在methods的下一级,与methodsonload都是同级。下面的代码是分享图片的写法onShareAppMessage(res) { return { title: '微信小程序测试分享', // path: '/p..原创 2021-07-09 10:54:11 · 204 阅读 · 0 评论 -
uni-app 中文档阅读倒计时
文章很长,文章下面的倒计时按钮,倒计时的时候不能点击,倒计时结束,按钮能点击的效果倒计时事件// 按钮的倒计时 countdown() { const that = this //修改倒计时时间 这里写了10s that.time = 10 const fn = setInterval(function() { //每一秒自减一 that.time-- if (that.time == 0)原创 2021-07-08 19:03:13 · 581 阅读 · 0 评论