日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

vue横屏分页加载 vue 分页 左右滑动分页 横着分页

發布時間:2024/1/1 vue 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vue横屏分页加载 vue 分页 左右滑动分页 横着分页 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

vue 分頁 加載 vue橫屏分頁加載
關鍵詞:橫著分頁,左右分頁,橫屏分頁,左右滑動分頁

b站視頻地址:https://b23.tv/sEYwH5

切記一定要把public/index.html 里面的body設置margin、padding 為0,不然可能會出問題

<template><div class="hello"><div class="list" id="tablist" @scroll="listScroll"><divclass="item"v-for="(item, i) in datas":key="i":class="i % 2 == 0 ? 'red' : 'skyblue'">{{ item }}</div><div v-if="loading" class="loading">loading...</div></div></div> </template><script> export default {name: "HelloWorld",props: {msg: String,},data() {return {flag: true, // 開關loading: false, // loading加載datas: [1, 2, 3, 4, 5, 6], // 列表數據};},methods: {listScroll() {const scrollLeft = document.getElementById("tablist").scrollLeft;console.log("卷去寬度", scrollLeft);const clientWidth = document.documentElement.clientWidth || document.body.clientWidth;console.log("屏幕寬度", clientWidth);const tablist = document.getElementById("tablist").scrollWidth;console.log("列表寬度", tablist);console.log("-----------");if (tablist - clientWidth === scrollLeft && this.flag) {// 列表寬度-屏幕寬度 = 卷曲寬度 且 開關是打開的狀態console.log("滑不動了");this.pageFn(); // 模擬 請求數據}},pageFn() {console.log("去分頁請求**********");this.flag = false; // 開關 關閉this.loading = true; // loading 打開const that = this;// 模擬延遲請求setTimeout(() => {that.reqFn(); // 接口請求數據}, 1500);},reqFn() {const num = this.datas.length + 1; // 模擬新數據this.datas.push(num); // 新數據賦值this.flag = true; // 開關 打開this.loading = false; // loading 關閉},}, }; </script><style scoped> .list {width: 100vw;height: 100px;overflow-x: scroll;white-space: nowrap; } .item {display: inline-block;width: 100px;height: 100px;box-sizing: content-box;line-height: 100px; } .red {background-color: red; } .skyblue {background-color: skyblue; } .loading {width: 80px;height: 100px;line-height: 100px;background: rgba(0, 0, 255, 0.664);display: inline-block; } </style><!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped> /* h3 {margin: 40px 0 0; } ul {list-style-type: none;padding: 0; } li {display: inline-block;margin: 0 10px; } a {color: #42b983; } */ </style>

總結

以上是生活随笔為你收集整理的vue横屏分页加载 vue 分页 左右滑动分页 横着分页的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。