<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        vue實現(xiàn)滑動堆疊組件

        來源:懂視網(wǎng) 責編:小采 時間:2020-11-27 19:55:55
        文檔

        vue實現(xiàn)滑動堆疊組件

        vue實現(xiàn)滑動堆疊組件:這次給大家?guī)韛ue實現(xiàn)滑動堆疊組件,vue實現(xiàn)滑動堆疊組件的注意事項有哪些,下面就是實戰(zhàn)案例,一起來看一下。前言 嗨,說起探探想必各位程序汪都不陌生(畢竟妹子很多),能在上面絲滑的翻牌子,探探的的堆疊滑動組件起到了關鍵的作用,下面就來看看如何用v
        推薦度:
        導讀vue實現(xiàn)滑動堆疊組件:這次給大家?guī)韛ue實現(xiàn)滑動堆疊組件,vue實現(xiàn)滑動堆疊組件的注意事項有哪些,下面就是實戰(zhàn)案例,一起來看一下。前言 嗨,說起探探想必各位程序汪都不陌生(畢竟妹子很多),能在上面絲滑的翻牌子,探探的的堆疊滑動組件起到了關鍵的作用,下面就來看看如何用v

        這次給大家?guī)韛ue實現(xiàn)滑動堆疊組件,vue實現(xiàn)滑動堆疊組件的注意事項有哪些,下面就是實戰(zhàn)案例,一起來看一下。

        前言

        嗨,說起探探想必各位程序汪都不陌生(畢竟妹子很多),能在上面絲滑的翻牌子,探探的的堆疊滑動組件起到了關鍵的作用,下面就來看看如何用vue寫一個探探的堆疊組件

        一. 功能分析

        簡單歸納下里面包含的基本功能點:

      1. 圖片的堆疊

      2. 圖片第一張的滑動

      3. 條件成功后的滑出,條件失敗后的回彈

      4. 滑出后下一張圖片堆疊到頂部

      5. 體驗優(yōu)化

      6. 根據(jù)觸摸點的不同,滑動時首圖有不同角度偏移

      7. 偏移面積判定是否成功滑出

      8. 二. 具體實現(xiàn)

        有了歸納好的功能點,我們實現(xiàn)組件的思路會更清晰

        1. 堆疊效果

        堆疊圖片效果在網(wǎng)上有大量的實例,實現(xiàn)的方法大同小異,主要通過在父層設定perspective 及perspective-origin ,來實現(xiàn)子層的透視,子層設定好translate3d Z軸數(shù)值即可模擬出堆疊效果,具體代碼如下

        // 圖片堆疊dom
         <!--opacity: 0 隱藏我們不想看到的stack-item層級-->
         <!--z-index: -1 調(diào)整stack-item層級"-->
        <ul class="stack">
         <li class="stack-item" style="transform: translate3d(0px, 0px, 0px);opacity: 1;z-index: 10;"><img src="1.png" alt="01"></li>
         <li class="stack-item" style="transform: translate3d(0px, 0px, -60px);opacity: 1;z-index: 1"><img src="2.png" alt="02"></li>
         <li class="stack-item" style="transform: translate3d(0px, 0px, -120px);opacity: 1;z-index: 1"><img src="3.png" alt="03"></li>
         <li class="stack-item" style="transform: translate3d(0px, 0px, -180px);opacity: 0;z-index: -1"><img src="4.png" alt="04"></li>
         <li class="stack-item" style="transform: translate3d(0px, 0px, -180px);opacity: 0;z-index: -1"><img src="5.png" alt="05"></li>
        </ul>
        <style>
        .stack {
         width: 100%;
         height: 100%;
         position: relative;
         perspective: 1000px; //子元素視距
         perspective-origin: 50% 150%; //子元素透視位置
         -webkit-perspective: 1000px;
         -webkit-perspective-origin: 50% 150%;
         margin: 0;
         padding: 0;
         }
         .stack-item{
         background: #fff;
         height: 100%;
         width: 100%;
         border-radius: 4px;
         text-align: center;
         overflow: hidden;
         }
         .stack-item img {
         width: 100%;
         display: block;
         pointer-events: none;
         }
        </style>

        上面只是一組靜態(tài)代碼,我們希望得到的是vue組件,所以需要先建立一個組件模板stack.vue,在模板中我們可以使用v-for,遍歷出stack節(jié)點,使用:style 來修改各個item的style,代碼如下

        <template>
         <ul class="stack">
         <li class="stack-item" v-for="(item, index) in pages" :style="[transform(index)]">
         <img :src="item.src">
         </li>
         </ul>
        </template>
        <script>
        export default {
         props: {
         // pages數(shù)據(jù)包含基礎的圖片數(shù)據(jù)
         pages: {
         type: Array,
         default: []
         }
         },
         data () {
         return {
         // basicdata數(shù)據(jù)包含組件基本數(shù)據(jù)
         basicdata: {
         currentPage: 0 // 默認首圖的序列
         },
         // temporaryData數(shù)據(jù)包含組件臨時數(shù)據(jù)
         temporaryData: {
         opacity: 1, // 記錄opacity
         zIndex: 10, // 記錄zIndex
         visible: 3 // 記錄默認顯示堆疊數(shù)visible
         }
         }
         },
         methods: {
         // 遍歷樣式
         transform (index) {
         if (index >= this.basicdata.currentPage) {
         let style = {}
         let visible = this.temporaryData.visible
         let perIndex = index - this.basicdata.currentPage
         // visible可見數(shù)量前滑塊的樣式
         if (index <= this.basicdata.currentPage + visible - 1) {
         style['opacity'] = '1'
         style['transform'] = 'translate3D(0,0,' + -1 * perIndex * 60 + 'px' + ')'
         style['zIndex'] = visible - index + this.basicdata.currentPage
         style['transitionTimingFunction'] = 'ease'
         style['transitionDuration'] = 300 + 'ms'
         } else {
         style['zIndex'] = '-1'
         style['transform'] = 'translate3D(0,0,' + -1 * visible * 60 + 'px' + ')'
         }
         return style
         }
         }
         }
        }
        </script>

        關鍵點

        :style 可以綁定對象的同時,也可以綁定數(shù)組和函數(shù),這在遍歷的時候很有用
        最基本的dom結(jié)構(gòu)已經(jīng)構(gòu)建完畢,下一步是讓首張圖片“動”起來

        2. 圖片滑動

        圖片滑動效果,在很多場景中都有出現(xiàn),其原理無非是監(jiān)聽touchs事件,得到位移,再通過translate3D改變目標位移,因此我們要實現(xiàn)的步驟如下

      9. 對stack進行touchs事件的綁定

      10. 監(jiān)聽并儲存手勢位置變化的數(shù)值

      11. 改變首圖css屬性中translate3D的x,y值

      12. #### 具體實現(xiàn)

        在vue框架中,不建議直接操作節(jié)點,而是通過指令v-on對元素進行綁定,因此我們將綁定都寫在v-for遍歷里,通過index進行判斷其是否是首圖,再使用:style修改首頁的樣式,具體代碼如下:

        <template>
         <ul class="stack">
         <li class="stack-item" v-for="(item, index) in pages"
         :style="[transformIndex(index),transform(index)]"
         @touchstart.stop.capture="touchstart"
         @touchmove.stop.capture="touchmove"
         @touchend.stop.capture="touchend"
         @mousedown.stop.capture="touchstart"
         @mouseup.stop.capture="touchend"
         @mousemove.stop.capture="touchmove">
         <img :src="item.src">
         </li>
         </ul>
        </template>
        <script>
        export default {
         props: {
         // pages數(shù)據(jù)包含基礎的圖片數(shù)據(jù)
         pages: {
         type: Array,
         default: []
         }
         },
         data () {
         return {
         // basicdata數(shù)據(jù)包含組件基本數(shù)據(jù)
         basicdata: {
         start: {}, // 記錄起始位置
         end: {}, // 記錄終點位置
         currentPage: 0 // 默認首圖的序列
         },
         // temporaryData數(shù)據(jù)包含組件臨時數(shù)據(jù)
         temporaryData: {
         poswidth: '', // 記錄位移
         posheight: '', // 記錄位移
         tracking: false // 是否在滑動,防止多次操作,影響體驗
         }
         }
         },
         methods: {
         touchstart (e) {
         if (this.temporaryData.tracking) {
         return
         }
         // 是否為touch
         if (e.type === 'touchstart') {
         if (e.touches.length > 1) {
         this.temporaryData.tracking = false
         return
         } else {
         // 記錄起始位置
         this.basicdata.start.t = new Date().getTime()
         this.basicdata.start.x = e.targetTouches[0].clientX
         this.basicdata.start.y = e.targetTouches[0].clientY
         this.basicdata.end.x = e.targetTouches[0].clientX
         this.basicdata.end.y = e.targetTouches[0].clientY
         }
         // pc操作
         } else {
         this.basicdata.start.t = new Date().getTime()
         this.basicdata.start.x = e.clientX
         this.basicdata.start.y = e.clientY
         this.basicdata.end.x = e.clientX
         this.basicdata.end.y = e.clientY
         }
         this.temporaryData.tracking = true
         },
         touchmove (e) {
         // 記錄滑動位置
         if (this.temporaryData.tracking && !this.temporaryData.animation) {
         if (e.type === 'touchmove') {
         this.basicdata.end.x = e.targetTouches[0].clientX
         this.basicdata.end.y = e.targetTouches[0].clientY
         } else {
         this.basicdata.end.x = e.clientX
         this.basicdata.end.y = e.clientY
         }
         // 計算滑動值
         this.temporaryData.poswidth = this.basicdata.end.x - this.basicdata.start.x
         this.temporaryData.posheight = this.basicdata.end.y - this.basicdata.start.y
         }
         },
         touchend (e) {
         this.temporaryData.tracking = false
         // 滑動結(jié)束,觸發(fā)判斷
         },
         // 非首頁樣式切換
         transform (index) {
         if (index > this.basicdata.currentPage) {
         let style = {}
         let visible = 3
         let perIndex = index - this.basicdata.currentPage
         // visible可見數(shù)量前滑塊的樣式
         if (index <= this.basicdata.currentPage + visible - 1) {
         style['opacity'] = '1'
         style['transform'] = 'translate3D(0,0,' + -1 * perIndex * 60 + 'px' + ')'
         style['zIndex'] = visible - index + this.basicdata.currentPage
         style['transitionTimingFunction'] = 'ease'
         style['transitionDuration'] = 300 + 'ms'
         } else {
         style['zIndex'] = '-1'
         style['transform'] = 'translate3D(0,0,' + -1 * visible * 60 + 'px' + ')'
         }
         return style
         }
         },
         // 首頁樣式切換
         transformIndex (index) {
         // 處理3D效果
         if (index === this.basicdata.currentPage) {
         let style = {}
         style['transform'] = 'translate3D(' + this.temporaryData.poswidth + 'px' + ',' + this.temporaryData.posheight + 'px' + ',0px)'
         style['opacity'] = 1
         style['zIndex'] = 10
         return style
         }
         }
         }
        }
        </script>

        3. 條件成功后的滑出,條件失敗后的回彈

        條件的觸發(fā)判斷是在touchend/mouseup后進行,在這里我們先用簡單的條件進行判定,同時給予首圖彈出及回彈的效果,代碼如下

        <template>
         <ul class="stack">
         <li class="stack-item" v-for="(item, index) in pages"
         :style="[transformIndex(index),transform(index)]"
         @touchmove.stop.capture="touchmove"
         @touchstart.stop.capture="touchstart"
         @touchend.stop.capture="touchend"
         @mousedown.stop.capture="touchstart"
         @mouseup.stop.capture="touchend"
         @mousemove.stop.capture="touchmove">
         <img :src="item.src">
         </li>
         </ul>
        </template>
        <script>
        export default {
         props: {
         // pages數(shù)據(jù)包含基礎的圖片數(shù)據(jù)
         pages: {
         type: Array,
         default: []
         }
         },
         data () {
         return {
         // basicdata數(shù)據(jù)包含組件基本數(shù)據(jù)
         basicdata: {
         start: {}, // 記錄起始位置
         end: {}, // 記錄終點位置
         currentPage: 0 // 默認首圖的序列
         },
         // temporaryData數(shù)據(jù)包含組件臨時數(shù)據(jù)
         temporaryData: {
         poswidth: '', // 記錄位移
         posheight: '', // 記錄位移
         tracking: false, // 是否在滑動,防止多次操作,影響體驗
         animation: false, // 首圖是否啟用動畫效果,默認為否
         opacity: 1 // 記錄首圖透明度
         }
         }
         },
         methods: {
         touchstart (e) {
         if (this.temporaryData.tracking) {
         return
         }
         // 是否為touch
         if (e.type === 'touchstart') {
         if (e.touches.length > 1) {
         this.temporaryData.tracking = false
         return
         } else {
         // 記錄起始位置
         this.basicdata.start.t = new Date().getTime()
         this.basicdata.start.x = e.targetTouches[0].clientX
         this.basicdata.start.y = e.targetTouches[0].clientY
         this.basicdata.end.x = e.targetTouches[0].clientX
         this.basicdata.end.y = e.targetTouches[0].clientY
         }
         // pc操作
         } else {
         this.basicdata.start.t = new Date().getTime()
         this.basicdata.start.x = e.clientX
         this.basicdata.start.y = e.clientY
         this.basicdata.end.x = e.clientX
         this.basicdata.end.y = e.clientY
         }
         this.temporaryData.tracking = true
         this.temporaryData.animation = false
         },
         touchmove (e) {
         // 記錄滑動位置
         if (this.temporaryData.tracking && !this.temporaryData.animation) {
         if (e.type === 'touchmove') {
         this.basicdata.end.x = e.targetTouches[0].clientX
         this.basicdata.end.y = e.targetTouches[0].clientY
         } else {
         this.basicdata.end.x = e.clientX
         this.basicdata.end.y = e.clientY
         }
         // 計算滑動值
         this.temporaryData.poswidth = this.basicdata.end.x - this.basicdata.start.x
         this.temporaryData.posheight = this.basicdata.end.y - this.basicdata.start.y
         }
         },
         touchend (e) {
         this.temporaryData.tracking = false
         this.temporaryData.animation = true
         // 滑動結(jié)束,觸發(fā)判斷
         // 簡單判斷滑動寬度超出100像素時觸發(fā)滑出
         if (Math.abs(this.temporaryData.poswidth) >= 100) {
         // 最終位移簡單設定為x軸200像素的偏移
         let ratio = Math.abs(this.temporaryData.posheight / this.temporaryData.poswidth)
         this.temporaryData.poswidth = this.temporaryData.poswidth >= 0 ? this.temporaryData.poswidth + 200 : this.temporaryData.poswidth - 200
         this.temporaryData.posheight = this.temporaryData.posheight >= 0 ? Math.abs(this.temporaryData.poswidth * ratio) : -Math.abs(this.temporaryData.poswidth * ratio)
         this.temporaryData.opacity = 0
         // 不滿足條件則滑入
         } else {
         this.temporaryData.poswidth = 0
         this.temporaryData.posheight = 0
         }
         },
         // 非首頁樣式切換
         transform (index) {
         if (index > this.basicdata.currentPage) {
         let style = {}
         let visible = 3
         let perIndex = index - this.basicdata.currentPage
         // visible可見數(shù)量前滑塊的樣式
         if (index <= this.basicdata.currentPage + visible - 1) {
         style['opacity'] = '1'
         style['transform'] = 'translate3D(0,0,' + -1 * perIndex * 60 + 'px' + ')'
         style['zIndex'] = visible - index + this.basicdata.currentPage
         style['transitionTimingFunction'] = 'ease'
         style['transitionDuration'] = 300 + 'ms'
         } else {
         style['zIndex'] = '-1'
         style['transform'] = 'translate3D(0,0,' + -1 * visible * 60 + 'px' + ')'
         }
         return style
         }
         },
         // 首頁樣式切換
         transformIndex (index) {
         // 處理3D效果
         if (index === this.basicdata.currentPage) {
         let style = {}
         style['transform'] = 'translate3D(' + this.temporaryData.poswidth + 'px' + ',' + this.temporaryData.posheight + 'px' + ',0px)'
         style['opacity'] = this.temporaryData.opacity
         style['zIndex'] = 10
         if (this.temporaryData.animation) {
         style['transitionTimingFunction'] = 'ease'
         style['transitionDuration'] = 300 + 'ms'
         }
         return style
         }
         }
         }
        }
        </script>

        4. 滑出后下一張圖片堆疊到頂部

        重新堆疊是組件最后一個功能,同時也是最重要和復雜的功能。在我們的代碼里,stack-item的排序依賴綁定:style的transformIndex和transform函數(shù),函數(shù)里判定的條件是currentPage,那是不是改變currentPage,讓其+1,即可完成重新堆疊呢?

        答案沒有那么簡單,因為我們滑出是動畫效果,會進行300ms的時間,而currentPage變化引起的重排,會立即變化,打斷動畫的進行。因此我們需要先修改transform函數(shù)的排序條件,后改變currentPage。

        #### 具體實現(xiàn)

      13. 修改transform函數(shù)排序條件

        讓currentPage+

      14. 添加onTransitionEnd事件,在滑出結(jié)束后,重新放置stack列表中

      15. 代碼如下:

        <template>
         <ul class="stack">
         <li class="stack-item" v-for="(item, index) in pages"
         :style="[transformIndex(index),transform(index)]"
         @touchmove.stop.capture="touchmove"
         @touchstart.stop.capture="touchstart"
         @touchend.stop.capture="touchend"
         @mousedown.stop.capture="touchstart"
         @mouseup.stop.capture="touchend"
         @mousemove.stop.capture="touchmove"
         @webkit-transition-end="onTransitionEnd"
         @transitionend="onTransitionEnd"
         >
         <img :src="item.src">
         </li>
         </ul>
        </template>
        <script>
        export default {
         props: {
         // pages數(shù)據(jù)包含基礎的圖片數(shù)據(jù)
         pages: {
         type: Array,
         default: []
         }
         },
         data () {
         return {
         // basicdata數(shù)據(jù)包含組件基本數(shù)據(jù)
         basicdata: {
         start: {}, // 記錄起始位置
         end: {}, // 記錄終點位置
         currentPage: 0 // 默認首圖的序列
         },
         // temporaryData數(shù)據(jù)包含組件臨時數(shù)據(jù)
         temporaryData: {
         poswidth: '', // 記錄位移
         posheight: '', // 記錄位移
         lastPosWidth: '', // 記錄上次最終位移
         lastPosHeight: '', // 記錄上次最終位移
         tracking: false, // 是否在滑動,防止多次操作,影響體驗
         animation: false, // 首圖是否啟用動畫效果,默認為否
         opacity: 1, // 記錄首圖透明度
         swipe: false // onTransition判定條件
         }
         }
         },
         methods: {
         touchstart (e) {
         if (this.temporaryData.tracking) {
         return
         }
         // 是否為touch
         if (e.type === 'touchstart') {
         if (e.touches.length > 1) {
         this.temporaryData.tracking = false
         return
         } else {
         // 記錄起始位置
         this.basicdata.start.t = new Date().getTime()
         this.basicdata.start.x = e.targetTouches[0].clientX
         this.basicdata.start.y = e.targetTouches[0].clientY
         this.basicdata.end.x = e.targetTouches[0].clientX
         this.basicdata.end.y = e.targetTouches[0].clientY
         }
         // pc操作
         } else {
         this.basicdata.start.t = new Date().getTime()
         this.basicdata.start.x = e.clientX
         this.basicdata.start.y = e.clientY
         this.basicdata.end.x = e.clientX
         this.basicdata.end.y = e.clientY
         }
         this.temporaryData.tracking = true
         this.temporaryData.animation = false
         },
         touchmove (e) {
         // 記錄滑動位置
         if (this.temporaryData.tracking && !this.temporaryData.animation) {
         if (e.type === 'touchmove') {
         this.basicdata.end.x = e.targetTouches[0].clientX
         this.basicdata.end.y = e.targetTouches[0].clientY
         } else {
         this.basicdata.end.x = e.clientX
         this.basicdata.end.y = e.clientY
         }
         // 計算滑動值
         this.temporaryData.poswidth = this.basicdata.end.x - this.basicdata.start.x
         this.temporaryData.posheight = this.basicdata.end.y - this.basicdata.start.y
         }
         },
         touchend (e) {
         this.temporaryData.tracking = false
         this.temporaryData.animation = true
         // 滑動結(jié)束,觸發(fā)判斷
         // 簡單判斷滑動寬度超出100像素時觸發(fā)滑出
         if (Math.abs(this.temporaryData.poswidth) >= 100) {
         // 最終位移簡單設定為x軸200像素的偏移
         let ratio = Math.abs(this.temporaryData.posheight / this.temporaryData.poswidth)
         this.temporaryData.poswidth = this.temporaryData.poswidth >= 0 ? this.temporaryData.poswidth + 200 : this.temporaryData.poswidth - 200
         this.temporaryData.posheight = this.temporaryData.posheight >= 0 ? Math.abs(this.temporaryData.poswidth * ratio) : -Math.abs(this.temporaryData.poswidth * ratio)
         this.temporaryData.opacity = 0
         this.temporaryData.swipe = true
         // 記錄最終滑動距離
         this.temporaryData.lastPosWidth = this.temporaryData.poswidth
         this.temporaryData.lastPosHeight = this.temporaryData.posheight
         // currentPage+1 引發(fā)排序變化
         this.basicdata.currentPage += 1
         // currentPage切換,整體dom進行變化,把第一層滑動置零
         this.$nextTick(() => {
         this.temporaryData.poswidth = 0
         this.temporaryData.posheight = 0
         this.temporaryData.opacity = 1
         })
         // 不滿足條件則滑入
         } else {
         this.temporaryData.poswidth = 0
         this.temporaryData.posheight = 0
         this.temporaryData.swipe = false
         }
         },
         onTransitionEnd (index) {
         // dom發(fā)生變化后,正在執(zhí)行的動畫滑動序列已經(jīng)變?yōu)樯弦粚? if (this.temporaryData.swipe && index === this.basicdata.currentPage - 1) {
         this.temporaryData.animation = true
         this.temporaryData.lastPosWidth = 0
         this.temporaryData.lastPosHeight = 0
         this.temporaryData.swipe = false
         }
         },
         // 非首頁樣式切換
         transform (index) {
         if (index > this.basicdata.currentPage) {
         let style = {}
         let visible = 3
         let perIndex = index - this.basicdata.currentPage
         // visible可見數(shù)量前滑塊的樣式
         if (index <= this.basicdata.currentPage + visible - 1) {
         style['opacity'] = '1'
         style['transform'] = 'translate3D(0,0,' + -1 * perIndex * 60 + 'px' + ')'
         style['zIndex'] = visible - index + this.basicdata.currentPage
         style['transitionTimingFunction'] = 'ease'
         style['transitionDuration'] = 300 + 'ms'
         } else {
         style['zIndex'] = '-1'
         style['transform'] = 'translate3D(0,0,' + -1 * visible * 60 + 'px' + ')'
         }
         return style
         // 已滑動模塊釋放后
         } else if (index === this.basicdata.currentPage - 1) {
         let style = {}
         // 繼續(xù)執(zhí)行動畫
         style['transform'] = 'translate3D(' + this.temporaryData.lastPosWidth + 'px' + ',' + this.temporaryData.lastPosHeight + 'px' + ',0px)'
         style['opacity'] = '0'
         style['zIndex'] = '-1'
         style['transitionTimingFunction'] = 'ease'
         style['transitionDuration'] = 300 + 'ms'
         return style
         }
         },
         // 首頁樣式切換
         transformIndex (index) {
         // 處理3D效果
         if (index === this.basicdata.currentPage) {
         let style = {}
         style['transform'] = 'translate3D(' + this.temporaryData.poswidth + 'px' + ',' + this.temporaryData.posheight + 'px' + ',0px)'
         style['opacity'] = this.temporaryData.opacity
         style['zIndex'] = 10
         if (this.temporaryData.animation) {
         style['transitionTimingFunction'] = 'ease'
         style['transitionDuration'] = 300 + 'ms'
         }
         return style
         }
         }
         }
        }
        </script>

        ok~ 完成了上面的四步,堆疊組件的基本功能就已經(jīng)實現(xiàn),快來看看效果吧

        相信看了本文案例你已經(jīng)掌握了方法,更多精彩請關注Gxl網(wǎng)其它相關文章!

        推薦閱讀:

        Native怎么使用fetch實現(xiàn)圖片上傳功能

        vue.js移動數(shù)組位置并實時更新視圖

        聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        vue實現(xiàn)滑動堆疊組件

        vue實現(xiàn)滑動堆疊組件:這次給大家?guī)韛ue實現(xiàn)滑動堆疊組件,vue實現(xiàn)滑動堆疊組件的注意事項有哪些,下面就是實戰(zhàn)案例,一起來看一下。前言 嗨,說起探探想必各位程序汪都不陌生(畢竟妹子很多),能在上面絲滑的翻牌子,探探的的堆疊滑動組件起到了關鍵的作用,下面就來看看如何用v
        推薦度:
        標簽: VUE 滑動 組件
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲AV综合色区无码一二三区| 毛茸茸bbw亚洲人| 亚洲综合激情另类小说区| 亚洲精品偷拍视频免费观看| 四虎永久免费网站免费观看| 日韩欧美亚洲中文乱码| 国产精品嫩草影院免费| 亚洲av色香蕉一区二区三区| 精品国产精品久久一区免费式| 亚洲色中文字幕在线播放| 成人免费无码大片a毛片| 亚洲高清毛片一区二区| 免费一级肉体全黄毛片| 青草青草视频2免费观看| 亚洲精品和日本精品| 国产无限免费观看黄网站| 亚洲av伊人久久综合密臀性色| 免费91最新地址永久入口| 亚洲免费人成视频观看| 在线观看无码的免费网站| 天天综合亚洲色在线精品| 亚洲国产精品成人AV无码久久综合影院| 一级毛片在线完整免费观看| 亚洲日韩人妻第一页| 久久国产免费一区| 亚洲www在线观看| 深夜国产福利99亚洲视频| 中国一级特黄的片子免费 | 女人毛片a级大学毛片免费| 亚洲AV无码一区二区三区电影 | 处破女第一次亚洲18分钟| 亚洲中文字幕无码永久在线| 免费高清国产视频| 亚洲一卡2卡3卡4卡乱码 在线| a级毛片无码免费真人| 免费人成视频在线观看免费| 亚洲AV无码乱码在线观看富二代| 国产成人精品久久免费动漫 | j8又粗又长又硬又爽免费视频| 亚洲av无码片在线播放| 久久久久久久久免费看无码|