当前位置: 首页 > news >正文

建设银行悦生活网站能自己做效果图的网站

建设银行悦生活网站,能自己做效果图的网站,西陆网,百度登录注册效果图 在app或者小程序中向下滑动 会出现刷新数据 ,而上拉到底 需要更新数据 功能实现 主要俩种方式 依赖生命周期 在page.json中开启 page.json "style" : {"navigationBarTitleText" : "小小练习","backgroundTextStyle": &qu…

效果图

在这里插入图片描述
在app或者小程序中向下滑动 会出现刷新数据 ,而上拉到底 需要更新数据

功能实现

主要俩种方式

依赖生命周期

在page.json中开启
在这里插入图片描述
page.json

		"style" : {"navigationBarTitleText" : "小小练习","backgroundTextStyle": "dark","enablePullDownRefresh": true}

开启后页面监听onPullDownRefresh()顶部下拉事件,onReachBottom触底事件

<template><view class="content"><view v-for="(item, index) in cats" :key="index"><image :style="{ width: item.width/2 + 'rpx', height: item.height/2 + 'rpx' }" :src="item.url"></image></view></view><view class="float"><view class="item">顶部</view><view class="item">刷新</view></view>
</template><script setup>
import { reactive,  onMounted } from 'vue';const cats = reactive([]);
onPullDownRefresh(() => {console.log('触发下拉刷新了');// 进行下拉刷新的操作,比如重新加载数据等refresh(); // 这里调用你封装的刷新数据的方法uni.stopPullDownRefresh();
});
onReachBottom(()=>{console.log('触底时间')PullDownRefresh()
})const PullDownRefresh= (()=>{uni.showLoading({title:'加载中',duration:1000})console.log('触发滑动区域刷新了')// 停止当前页面下拉刷新refresh()}) const addrefresh=()=>{console.log('滑动到进行更新')uni.request({url: 'https://api.thecatapi.com/v1/images/search?limit=2',success(res) {console.log('获取接口成功', res);// cats.length = 0; // 不清空清空数组res.data.forEach(item => {cats.push(item); // 将接口数据逐个添加到cats数组中});},fail: (e) => {console.log('获取接口失败');}});}
const refresh=()=>{uni.request({url: 'https://api.thecatapi.com/v1/images/search?limit=2',success(res) {console.log('获取接口成功', res);cats.length = 0; // 不清空清空数组res.data.forEach(item => {cats.push(item); // 将接口数据逐个添加到cats数组中});},fail: (e) => {console.log('获取接口失败');}});
}
onMounted(() => {
refresh()
});
</script><style lang="scss" scoped>
/* 样式 */
.float{position: absolute;right: 30rpx;bottom: 100rpx;.item{width: 90rpx;height: 90rpx;background: rgba(165, 213, 255, 0.0);border-radius: 50%;align-items: center;justify-content: center;padding-bottom: env(safe-area-inset-bottom);display: flex;border: 1px solid rebeccapurple;margin-bottom: 15rpx;}
}
</style>

依赖滚动视图组件

在这里插入图片描述
主要依赖这俩个事件
在这里插入图片描述

<template><scroll-view @scrolltoupper="PullDownRefresh" scroll-y="true" style="height: 1080rpx;" class="scroll-Y" @scrolltolower="addrefresh"><view v-for="(item, index) in cats" :key="index"><image :style="{ width: item.width/2 + 'rpx', height: item.height/2 + 'rpx' }" :src="item.url"></image></view></scroll-view><view class="float"><view class="item">顶部</view><view class="item">刷新</view></view>
</template><script setup>
import { reactive,  onMounted } from 'vue';const cats = reactive([]);const PullDownRefresh= (()=>{uni.showLoading({title:'加载中',duration:1000})console.log('触发滑动区域刷新了')// 停止当前页面下拉刷新refresh()}) const addrefresh=()=>{console.log('滑动到进行更新')uni.request({url: 'https://api.thecatapi.com/v1/images/search?limit=2',success(res) {console.log('获取接口成功', res);// cats.length = 0; // 不清空清空数组res.data.forEach(item => {cats.push(item); // 将接口数据逐个添加到cats数组中});},fail: (e) => {console.log('获取接口失败');}});}
const refresh=()=>{uni.request({url: 'https://api.thecatapi.com/v1/images/search?limit=2',success(res) {console.log('获取接口成功', res);cats.length = 0; // 不清空清空数组res.data.forEach(item => {cats.push(item); // 将接口数据逐个添加到cats数组中});},fail: (e) => {console.log('获取接口失败');}});
}
onMounted(() => {
refresh()
});
</script>

这种方式没有自带的动画 并且需要设置滑动区域的高度,不然可能滑倒底部没数据了但是由于没有到组件底部无法触发事件

当上拉更新数据过多时,想要在滑动顶部进行更新数据时候,就需要滑动很长事件,所以可以使用uni.pageScrollTo(OBJECT) 快速到达页面指定位置
在这里插入图片描述

http://www.yayakq.cn/news/782200/

相关文章:

  • 白云做网站要多少钱成都系统软件定制开发
  • 怎么建网站平台卖东西泰安房产网签成交数据
  • 网站推广的方案设计怎么写设计网站推荐html
  • 学做甜品的网站国外网站设计欣赏
  • 网站好友邀请链接生成 phpwordpress 添加栏目
  • html5 单页 响应式 网站模板网站模板工具
  • SharePoint做网站好吗网站怎么做到秒收录
  • 优设网站怎么下载关键词排名什么意思
  • 兰溪好品质高端网站设计如何为公司建立网站
  • 马化腾做的电商网站桂电做网站的毕设容易过嘛
  • wordpress安装到网站阿里云怎么上传wordpress
  • 佛山小网站建设网站尾部
  • 西安广告网站制作比较好的网页网站设计
  • 域名注册网站 简称台州网站制作台州网站建设
  • 合肥市城乡建设局网站聊城专业建网站价格
  • 网站专业性免费评价工具青岛做网站的公司哪家好
  • 公网怎么做网站网站建设关键词分类
  • 张掖网站建设公司北京通信管理局网站备案处
  • 网站微场景代码青岛seo招聘
  • 自己做网站做淘宝客绿色食品网站建设论文
  • 婚庆网站名字sem营销
  • 郑州网站排名哪家好wordpress案例站点
  • 南宁网站建设南宁国内seo公司排名
  • 叫外包公司做网站不肯给源代码的官方网站怎样做
  • 怎么制作微网站网络推广公司成都
  • 一个网站一年的费用多少口碑营销的定义
  • 大连免费建站模板网站建设的售后
  • 企业网站设计哪个好城乡住房和城乡建设部网站
  • 第三方公司做网站价格详情页模板哪个网站好
  • 做国际贸易的有哪有个网站南京本地网站建站