一、Uni-app中的页面触发函数onLoad页面加载了、onShow页面显示了、onReady页面初次渲染、onHide页面隐藏
export default {
data() {
return {
title: 'Hello'
}
},
onLoad(object) {
console.log('页面加载了,我可以页面传参',object)
},
onShow() {
console.log('页面显示了')
},
onReady() {
console.log('页面初次渲染完成')
},
onHide() {
console.log('页面隐藏了')
},
methods: {
}
}
二、Uni-app中的数据刷新和请求,onPullDownRefresh () 页面刷新就执行该函数、onReachBottom()页面触底就执行该函数
<button @click="get">我是get请求</button>
onPullDownRefresh () {
console.log('触发了下拉刷新')
setTimeout(()=>{
this.list=['java','前端','php','web']
uni.stopPullDownRefresh()
},2000)
}
onReachBottom() {
console.log('页面触底了')
this.list = [...this.list,...['前端','java','php','ui','前端','java','php','ui']]
},
三、关闭下拉刷新和get请求
methods: {
PullDown() {
uni.startPullDownRefresh()
},
get() {
uni.request({
url:"http://localhost:8080/pages/list/list",
})
}
}
三、Uni-app中的字体引用~@/static/
@font-face {font-family: "iconfont";
src: url('~@/static/fonts/iconfont.eot?t=1564622062967');
src: url('~@/static/fonts/iconfont.eot?t=1564622062967#iefix') format('embedded-opentype'),
|