uni-app
- input框的一些属性
- uni-app里不一样的地方
- 发起网络请求 $myRequest方法挂载到全局
- 数据缓存
- 图片的上传和预览
- 条件编译跨端兼容
- 导航跳转和传参
- 两种方法导航跳转和传参
- 组件的创建使用和组件的生命周期函数
- button的三个属性 primary default warn
- 组件之间的通迅方式
- map组件和 uni.makePhoneCall()的使用
input框的一些属性
常用的并且能为大多数浏览器所识别的类型大概有:text、password、number、
button、reset、submit、hidden、radio、checkbox、file、image、
color、range、date、month、week、time、datetime-local。
另外还有一些类型:tel、email、url、datetime、search。这些类型部分浏览器不支持识别或校验。
uni-app里不一样的地方
selectable //是否选中
space="ensp" //空格 字符里的空格就显示出来了
space="emsp" //相当于中文字符的一个字符
space="nbsp" //也是相当于一个中字
hover-class="box" //相当于css里的hover 属性
hover-stop-propagation //阻止冒泡
:hover-start-time //相当于一个计时器
:hover-stay-time //相当于一个计时器
button按钮组件使用
<button>按钮</button>
<button size="mini">按钮</button>
<button type="primary">按钮</button>
<button type="primary" plain>按钮</button>
loading
image的一些属性
<image src="" mode="aspectFill" mode="aspectFit"></image>
css
<style>
//以这种方式引入css
@import url("./a.css")
</style>
uni-app的生命周期
页面触底
onReachBottom(){
console.log('触底了')
this.pageindex++
this.getGoodsList()
}
下拉刷新
第一种方法:
uni.startPullDownRefresh(){}
第二种方法:
onPullDownRefresh:function(){
console.log("触发了 刷新")
uni.stopPullDownRefresh() //执行完毕后停止刷新
},
//也可以写在 定时器里面
setTimeout(()=>{
console.log("触发了 刷新")
uni.stopPullDownRefresh()
},2000)
发起网络get请求 $myRequest方法挂载到全局
全部写在 methods里
return里定义一个 swiper:[]
index>index.vue>javascript
onLoad(){
this.getSwipers()
}
methods:{
getSwipers(){
//获取轮播图的数据 数据链接
uni:request({
url:"",
success:res=>{
console.log(res)
if(res.data.status !== 0){
return uni.showToast({
title:'获取数据失败'
})
}
}
this.swipers = res.data.message
})
}
}
<!--第二种方法-->
methods:{
<!--获取轮播图的数据-->
async getSwipers(){
const res = await uni.request({
url:'http://localhost:8082/api/getlunbo'
})
<!--console.log(res) /