国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

臨平網(wǎng)站建設(shè)互聯(lián)網(wǎng)營銷推廣怎么做

臨平網(wǎng)站建設(shè),互聯(lián)網(wǎng)營銷推廣怎么做,真人荷官網(wǎng)站建設(shè),電子商務(wù)專業(yè)可以從事什么工作虛擬列表,實際上就是在首屏加載的時候,只加載可視區(qū)域內(nèi)需要的列表項,當(dāng)滾動發(fā)生時,動態(tài)通過計算獲得可視區(qū)域內(nèi)的列表項,并將非可視區(qū)域內(nèi)存在的列表項刪除。該技術(shù)是解決渲染大量數(shù)據(jù)的一種解決方法。 實現(xiàn)虛擬列表&…

虛擬列表,實際上就是在首屏加載的時候,只加載可視區(qū)域內(nèi)需要的列表項,當(dāng)滾動發(fā)生時,動態(tài)通過計算獲得可視區(qū)域內(nèi)的列表項,并將非可視區(qū)域內(nèi)存在的列表項刪除。該技術(shù)是解決渲染大量數(shù)據(jù)的一種解決方法。
實現(xiàn)虛擬列表,需要獲取以下幾個屬性

  1. 可視區(qū)域起始數(shù)據(jù)索引(startIndex)
  2. 可視區(qū)域結(jié)束數(shù)據(jù)索引(endIndex)
  3. 計算可視區(qū)域數(shù)據(jù),并渲染到頁面中
  4. 計算startIndex對應(yīng)的數(shù)據(jù)在整個列表中的偏移位置listTop并設(shè)置到列表上

高度固定

令A(yù)pp組件(父組件)產(chǎn)生一萬條虛擬數(shù)據(jù)來模擬接口,在List組件中實現(xiàn)對應(yīng)的功能

App組件:

<template><div><List :items="items" :size="60" :shownumber="10"></List></div>
</template><script>
import List from '@/List.vue'
export default {components: {List},computed: {// 模擬數(shù)據(jù)items() {return Array(10000).fill('').map((item, index) => ({id: index,content: index}))}}
};
</script><style scoped></style>

List組件:

<template><div class="container" :style="{ height: containerHeight }" @scroll="handleScroll" ref="container"><!-- 數(shù)據(jù)列表 --><div class="list" :style="{top:listTop}"><!-- 列表項 --><div v-for="item in showData" :key="item.id" :style="{height:size+'px'}">{{ item.content }}</div><!-- 用于撐開高度的元素 --><div class="bar" :style="{height:barHeight}"></div></div></div>
</template><script>
export default {name: 'List',props:{// 要渲染的數(shù)據(jù)items:{type:Array,required:true},// 每條數(shù)據(jù)渲染節(jié)點的高度size:{type:Number,required:true},// 每次渲染DOM節(jié)點個數(shù)shownumber:{type:Number,required:true}},data(){return{start:0,  //要展示數(shù)據(jù)的其實下標(biāo)end:this.shownumber  //結(jié)束下標(biāo)}},computed:{// 最終展示數(shù)據(jù)showData(){return this.items.slice(this.start,this.end)},// 容器的高度containerHeight(){return this.size * this.shownumber + 'px'},// 撐開容器內(nèi)部高度的元素的高度barHeight(){return this.size * this.items.length + 'px'},// 列表項上滾動改變top的值listTop(){return this.start * this.size + 'px'},},methods:{// 容器滾動事件handleScroll(){// 獲取容器頂部滾動的尺寸const scrollTop = this.$refs.container.scrollTopthis.start = Math.floor(scrollTop / this.size)this.end = this.start + this.shownumber}}
};
</script><style scoped>
.container{overflow-y: scroll;background-color: rgb(150,150,150,.5);font-size: 20px;font-weight: bold;line-height: 60px;width: 500px;margin: 0 auto;position: relative;text-align: center;
}
.list{position: absolute;top: 0;width: 100%;
}
</style>

這樣可以實現(xiàn)一個簡單的固定高度的虛擬列表功能。

http://m.aloenet.com.cn/news/44725.html

相關(guān)文章:

  • 列舉網(wǎng)站開發(fā)常用的工具電腦培訓(xùn)班速成班
  • 淘寶網(wǎng)站的建設(shè)目標(biāo)是北京百度seo排名點擊軟件
  • 佛山高明建網(wǎng)站都有什么推廣平臺
  • sns網(wǎng)站社區(qū)需求分析文檔百度廣告投放公司
  • 軟文推廣有哪些平臺seo外包方案
  • 網(wǎng)站建設(shè)內(nèi)部問卷百度關(guān)鍵詞規(guī)劃師
  • 番禺有經(jīng)驗的網(wǎng)站建設(shè)電商培訓(xùn)班一般多少錢
  • 做棋牌網(wǎng)站要什么源碼上海seo培訓(xùn)中心
  • 做網(wǎng)站流量的方法拼多多seo搜索優(yōu)化
  • 建設(shè)銀行網(wǎng)站登錄視頻號直播推廣二維碼
  • Php外貿(mào)網(wǎng)站建設(shè)新浪博客長沙seo關(guān)鍵詞排名優(yōu)化
  • 佛山微網(wǎng)站建設(shè)seo新站如何快速排名
  • 網(wǎng)站建設(shè)崗位職責(zé)西安seo經(jīng)理
  • 全國網(wǎng)站建設(shè)公司排名無錫谷歌推廣
  • 如何做網(wǎng)校網(wǎng)站江蘇企業(yè)seo推廣
  • 做眾籌網(wǎng)站成都十大營銷策劃公司
  • 杭州做網(wǎng)站的公司排行全國疫情高峰感染高峰
  • 深圳沙井做公司網(wǎng)站最近最新的新聞
  • woocommerce做零售網(wǎng)站網(wǎng)站排名推廣工具
  • 網(wǎng)站開發(fā)需要有什么證書搜索引擎排名查詢工具
  • 大連自己的網(wǎng)站大數(shù)據(jù)營銷專業(yè)
  • 做網(wǎng)站 怎么選擇公司今日新聞聯(lián)播主要內(nèi)容摘抄
  • 找別人做網(wǎng)站交貨時應(yīng)該注意什么禁止搜索引擎收錄的方法
  • 網(wǎng)站建設(shè)貳金手指科杰2如何做電商賺錢
  • 電子商務(wù)網(wǎng)站建設(shè)可用性深圳市seo網(wǎng)絡(luò)推廣哪家好
  • 建設(shè)政府網(wǎng)站多少錢青島seo關(guān)鍵詞排名
  • 建設(shè)部規(guī)范網(wǎng)站關(guān)鍵詞優(yōu)化的策略有哪些
  • 黃驊市第五中學(xué)北京seo推廣外包
  • 想在百度做網(wǎng)站自動推廣工具
  • 開發(fā)大型網(wǎng)站的流程推廣方案經(jīng)典范文