uniapp-使用心得
https://uniapp.dcloud.io/api/router?id=navigateto
1.对象 转换 JSON
const params = {
pos_id:data.pos_id,
pos_name:data.pos_name,
site_name:data.site_name,
pay_amount:data.pay_amount,
order_id:data.order_id
}
console.log(params)
const paramsJson = JSON.stringify(params)
1.JSON 转换对象 接收后: const paramsObj = JSON.parse(options.param_data)
1.非tab页面
uni.navigateTo 非 tabBar,可以带参数 保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack
可以返回到原页面。
uni.redirectTo 非tabBar,可以带参数 关闭当前页面,跳转到应用内的某个页面。
2.tab页面
uni.switchTab
transform:scale(0.7);
PUSH 追加数据,下拉加载
/**
* 上拉加载
*/
onReachBottom() {
console.log('上拉加载')
if(this.loading === 'noMore') return
this.page++
this.getUserPosLikeApi()
},
methods:{
getUserPosLikeApi(){
const that = this const params = {
list_rows:that.list_rows,
page:that.page
} that.$myRequest.globalRequest(that.$myRouteApi._getUserPosLikeList,params)
.then((res)=>{
const data = res.data.data // console.log(data)
if (data.length==){
that.loading = 'noMore'
return
}
// 分页的长度不等于当前的页数
if (data.length != that.list_rows) {
that.loading = 'noMore'
}
data.forEach((item)=>{
this.getUserPosLikeList.push(item)
}) })
},
子组件-触发事件后返回到父组件 1.子组件触发点击事件: js: that.$emit('demo') . <!-- 组件 -->
<view class="userLikePosWrapper">
<list-pos-like :item="item.pos" v-for="item,index in getUserPosLikeList" @demo="hehe" :key="index"></list-pos-like>
</view>
<!-- --> <script>
export default {
data() {
return {
getUserPosLikeList:[], // 收藏的商家列表
}
},
onLoad(options){
console.log('获取自己收藏的商家列表') },
methods:{
hehe(){
console.log('xxxhehe')
}
}
}
</script>
.子组件传值: methods:{
onCheck(id){
console.log('onCheck:'+id)
// this.chechId = id
this.$emit('send',id)
}
} ---------
<deng-button :listData="oilList" :chechId="chechId" @send="onCheckOilType"></deng-button> onCheckOilType(res){
console.log('-=--------')
console.log(res)
// this.chechId =
}
子组件没有改变时,
增加 监听事件,+data <script>
export default {
props:{
listData: {
type: Array,
default () {
return []
}
},
chechId: {
type: Number,
default: ''
}
},
// 可以监听 data props 值的变化
watch: {
chechId(newVal) {
this.id = newVal
}
},
data() {
return {
id:
};
},
methods:{
onCheck(id){
console.log('onCheck:'+id)
// this.chechId = id
this.$emit('send',id)
}
}
}
</script>
1. 自定义组件: // components/组件名/组件名.vue 则不需要
<script>
import tabbar from '@/components/tabbar/tabbar.vue'
export default {
components:{
tabbar
},
data() {
return {
};
}
</script>
box-sizing: border-box;
只允许在盒内显示 display: flex;
justify-content: center;
align-items: center;
padding: 15rpx;
box-sizing: border-box;
==================================
box-sizing:border-box 让它在盒内显示,,不会超出了
padding: 15px <view :style="{height:statusBarHeight+'px'}"></view> 固定顶部导航栏 position:fixed [固定漂浮]
.使用阿里图标库 https://ext.dcloud.net.cn/plugin?id=28 点击插件导入
发送短信验证码 this.showSendSms = false
var interval = setInterval(() => {
--this.second
console.log(this.second)
}, )
setTimeout(() => {
clearInterval(interval)
this.showSendSms = true
this.second = 40
}, )
:style="[{backgroundImage:'url(' + img_all.path + ')' }]"
<view class="cu-item flex-sub" :class="index==TabCur?'text-orange cur':''" v-for="(item,index) in navArray"
:key="index"
@tap="tabSelect"
:data-id="index"
:data-need-type="item.need_type"
>
页面跳转
uni.navigateTo({
'url':'../tripinfo/tripinfo'
})
https://ext.dcloud.net.cn/publisher?id=78736
------------------------------------------------------------
项目配置
main.js import sign from './pages/home/sign.vue'
Vue.component('sign',sign) pages.json
{
"path": "pages/home/sign",
"style": {}
},
【index】
<sign v-if="PageCur=='sign'"></sign>
<view class="action" @click="NavChange" data-cur="sign">
<view class='cuIcon-cu-image'>
<image :src="'/static/tabbar/basics' + [PageCur=='sign'?'_cur':''] + '.png'"></image>
</view>
<view :class="PageCur=='sign'?'text-green':'text-gray'">元素</view>
</view>
<template name="sign">
<view>
<cu-custom bgColor="bg-gradual-red" :isBack="true">
<!-- <block slot="backText">返回</block> -->
<block slot="content">图标</block>
</cu-custom>
sign
</view>
</template>
------------------------------------------------------------
1.
const api = 不允许加逗号
bg-gradual-blue
------------
bg-gradual-orange
----
bg-gradual-pink
uniapp-使用心得的更多相关文章
- uni-app学习心得和填坑,关于uni-app 打包h5 页面的坑
第一次使用博客园写博客 1.我写博客的原因,梳理知识,整理思路,好记性不如烂笔头做个记录吧!记录生活! 1.了解 大概在我使用hbuilder的时候,在官网浏览下载的hbuilder时候无意中发现了u ...
- vue+uni-app商城实战 | 第一篇:【有来小店】微信小程序快速开发接入Spring Cloud OAuth2认证中心完成授权登录
一. 前言 本篇通过实战来讲述如何使用uni-app快速进行商城微信小程序的开发以及小程序如何接入后台Spring Cloud微服务. 有来商城 youlai-mall 项目是一套全栈商城系统,技术栈 ...
- uniapp分包(详尽版)
PS:本文是笔者对基于uniapp的一小程序项目进行分包后的复盘文档,不足之处请多多指教. 一:分包相关概念 本质上是改变项目的路由以及优化项目各个模块的启动时间的一种优化技术. 主包与分包的概念 1 ...
- 我的MYSQL学习心得(一) 简单语法
我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) 数据类型 我的MYSQL学习心得(五) 运 ...
- NoSql数据库使用半年后在设计上面的一些心得
NoSql数据库这个概念听闻许久了,也陆续看到很多公司和产品都在使用,优缺点似乎都被分析的清清楚楚.但我心里一直存有一个疑惑,它的出现究竟是为了解决什么问题? 这个疑惑非常大,为此我看了很多分析文章, ...
- 我的MYSQL学习心得(二) 数据类型宽度
我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) 数据类型 我的MYSQL学习心得(五) 运 ...
- 我的MYSQL学习心得(三) 查看字段长度
我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(四) 数据类型 我的MYSQL学习心得(五) 运 ...
- 我的MYSQL学习心得(四) 数据类型
我的MYSQL学习心得(四) 数据类型 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(五) 运 ...
- 我的MYSQL学习心得(五) 运算符
我的MYSQL学习心得(五) 运算符 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) 数据 ...
- 我的MYSQL学习心得(六) 函数
我的MYSQL学习心得(六) 函数 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) 数据类 ...
随机推荐
- 一文带你了解 HTTP 黑科技
这是 HTTP 系列的第三篇文章,此篇文章为 HTTP 的进阶文章. 在前面两篇文章中我们讲述了 HTTP 的入门,HTTP 所有常用标头的概述,这篇文章我们来聊一下 HTTP 的一些 黑科技. HT ...
- GP工作室——系统设计
团队作业第二次--系统设计 问题 答案 这个作业属于哪个课程 软件工程 这个作业要求在哪里 作业要求 团队名称 GP工作室 这个作业的目标 对项目软件进行更为详细的系统性设计 按照本游戏的设计要求,我 ...
- 基本库使用(urllib,requests)
urllib(request,error,parse,robotparse) request模块 方法:urlopen() {read(),readinto(),getheader(name), ...
- centos MySQL安装与卸载
1.配置YUM源 在MySQL官网中下载YUM源rpm安装包:https://dev.mysql.com/downloads/repo/yum/ wget http://dev.mysql.com/g ...
- ios---scrollview用法总结
一.使用步骤: 1.添加子组件到scrollview //必要步骤 2.设置clipsToBounds来确定超出范围是否被剪裁 (默认yes) self.scrolltest.clipsToBound ...
- mysql--->mysql的事务和锁
mysql 事务和锁 什么是事务?及其特性? 答:事务:是一系列的数据库操作,是数据库应用的基本逻辑单位. 或者这样理解: 事务就是被绑定在一起作为一个逻辑工作单元的SQL语句分组,如果任何一个语句操 ...
- pycharm版本下载地址
https://www.runoob.com/w3cnote/pycharm-windows-install.html 下载社区版本,因为免费 其余按照默认安装即可
- 异常处理 | manual close is not allowed over a Spring managed SqlSession
背景: 今天启动一个老项目,控制台打印出以下异常,大概是说在Spring托管的SqlSession上不允许手动关闭: java.lang.UnsupportedOperationException: ...
- CVE-2020-3110、CVE-2020-3111、CVE-2020 -3118、CVE-2020-3119、CVE-2020-3120 cdpwn 解析
CVE-2020-3110.CVE-2020-3111.CVE-2020 -3118.CVE-2020-3119.CVE-2020-3120 cdpwn 解析 攻击条件 在同一广播域,黑客即可通过cd ...
- python序列化对象和反序列化
1.首先不管哪种语言都会用到序列化和反序列化的过程, 2.序列化:把对象转换为字节序列的过程称为对象的序列化: 反序列化:把对象转换为字节序列的过程称为对象的序列化. 3.序列化的作用:把对象(变 ...