웹 프론트엔드 JS 튜토리얼 Vue는 슬라이딩 스태킹 구성 요소를 구현합니다.

Vue는 슬라이딩 스태킹 구성 요소를 구현합니다.

Apr 11, 2018 pm 04:30 PM
스택 슬라이드 구성 요소

이번에는 vue에서 슬라이딩 스태킹 컴포넌트 구현에 대해 알려드리겠습니다. vue에서 슬라이딩 스태킹 컴포넌트 구현 시 주의사항은 무엇입니까? 다음은 실제 사례입니다.

머리말

안녕하세요, 탄탄(Tantan)에 대해 말씀드리자면 여러분 모두 이 프로그램에 대해 잘 알고 계시리라 생각합니다(결국 여자분들이 많죠). 탄탄의 겹겹이 쌓인 슬라이딩 부품이 브랜드를 원활하게 뒤집는 데 중요한 역할을 하는지 살펴보겠습니다. 탄탄 스태킹 컴포넌트

로 작성해보세요. 1. 기능 분석

포함된 기본 기능 사항에 대한 간략한 요약:

  • 사진 쌓기

  • 첫 번째 사진 슬라이딩


  • 조건 성공 후 슬라이드 아웃, 조건 실패 후 리바운드


  • 다음 사진은 이후 위에 쌓인다 슬라이딩 아웃


  • 경험 최적화


  • 슬라이드할 때 터치 포인트에 따라 첫 번째 이미지가 다른 각도로 오프셋됩니다.


  • 오프셋 영역에 따라 슬라이드 아웃 여부가 결정됩니다. 성공


2. 구체적인 구현

요약된 기능적 포인트를 통해 컴포넌트 구현에 대한 우리의 아이디어가 더욱 명확해질 것입니다

1.스태킹 효과

인터넷에는 쌓인 그림 효과의 예가 많이 있습니다. 구현 방법은 유사합니다. 하위 레이어의 원근감은 주로 상위 레이어에 원근감과 원점을 설정하여 얻을 수 있습니다. 하위 레이어에서 Translate3d Z축 값을 설정하는 경우 구체적인 코드는 다음과 같습니다

// 图片堆叠dom
 <!--opacity: 0 隐藏我们不想看到的stack-item层级-->
 <!--z-index: -1 调整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>
로그인 후 복사

위는 단지 정적 코드 집합입니다. 우리가 얻고자 하는 것은 vue 구성 요소이므로 먼저 구성 요소 템플릿 stack.vue를 만들어야 합니다. 템플릿에서 v-for를 사용하여 스택 노드를 순회할 수 있습니다. :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数据包含基础的图片数据
 pages: {
  type: Array,
  default: []
 }
 },
 data () {
 return {
  // basicdata数据包含组件基本数据
  basicdata: {
  currentPage: 0 // 默认首图的序列
  },
  // temporaryData数据包含组件临时数据
  temporaryData: {
  opacity: 1, // 记录opacity
  zIndex: 10, // 记录zIndex
  visible: 3 // 记录默认显示堆叠数visible
  }
 }
 },
 methods: {
 // 遍历样式
 transform (index) {
  if (index >= this.basicdata.currentPage) {
  let style = {}
  let visible = this.temporaryData.visible
  let perIndex = index - this.basicdata.currentPage
  // visible可见数量前滑块的样式
  if (index <= this.basicdata.currentPage + visible - 1) {
   style[&#39;opacity&#39;] = &#39;1&#39;
   style[&#39;transform&#39;] = &#39;translate3D(0,0,&#39; + -1 * perIndex * 60 + &#39;px&#39; + &#39;)&#39;
   style[&#39;zIndex&#39;] = visible - index + this.basicdata.currentPage
   style[&#39;transitionTimingFunction&#39;] = &#39;ease&#39;
   style[&#39;transitionDuration&#39;] = 300 + &#39;ms&#39;
  } else {
   style[&#39;zIndex&#39;] = &#39;-1&#39;
   style[&#39;transform&#39;] = &#39;translate3D(0,0,&#39; + -1 * visible * 60 + &#39;px&#39; + &#39;)&#39;
  }
  return style
  }
 }
 }
}
</script>
로그인 후 복사

핵심 포인트

:style은 배열과 함수뿐만 아니라 객체도 바인딩할 수 있는데, 이는 탐색할 때 매우 유용합니다. 다음 단계는 첫 번째 그림을 "이동"시키는 것입니다.
2. 그림 슬라이딩

그림 슬라이딩 효과는 여러 장면에서 나타납니다. 그 원리는 터치 이벤트를 듣고 변위를 얻은 다음 Translate3D를 통해 대상 변위를 변경하는 것입니다. 따라서 우리가 달성하려는 단계는 다음과 같습니다. 터치 이벤트를 스택에 바인딩

제스처 위치 변경 값을 모니터링하고 저장
  • 첫 번째 이미지의 CSS 속성에서 Translate3D의 x, y 값을 변경


  • #### 구체적인 구현

    vue 프레임워크에서는 노드를 직접 조작하는 것이 아니라 v-on 명령을 통해 요소를 바인딩하는 것을 권장합니다. 따라서 순회를 위해 v-에 바인딩을 작성하고 인덱스를 사용하여 첫 번째 이미지인지 확인합니다. 그런 다음 :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数据包含基础的图片数据
     pages: {
      type: Array,
      default: []
     }
     },
     data () {
     return {
      // basicdata数据包含组件基本数据
      basicdata: {
      start: {}, // 记录起始位置
      end: {}, // 记录终点位置
      currentPage: 0 // 默认首图的序列
      },
      // temporaryData数据包含组件临时数据
      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
      // 滑动结束,触发判断
     },
     // 非首页样式切换
     transform (index) {
      if (index > this.basicdata.currentPage) {
      let style = {}
      let visible = 3
      let perIndex = index - this.basicdata.currentPage
      // visible可见数量前滑块的样式
      if (index <= this.basicdata.currentPage + visible - 1) {
       style[&#39;opacity&#39;] = &#39;1&#39;
       style[&#39;transform&#39;] = &#39;translate3D(0,0,&#39; + -1 * perIndex * 60 + &#39;px&#39; + &#39;)&#39;
       style[&#39;zIndex&#39;] = visible - index + this.basicdata.currentPage
       style[&#39;transitionTimingFunction&#39;] = &#39;ease&#39;
       style[&#39;transitionDuration&#39;] = 300 + &#39;ms&#39;
      } else {
       style[&#39;zIndex&#39;] = &#39;-1&#39;
       style[&#39;transform&#39;] = &#39;translate3D(0,0,&#39; + -1 * visible * 60 + &#39;px&#39; + &#39;)&#39;
      }
      return style
      }
     },
     // 首页样式切换
     transformIndex (index) {
      // 处理3D效果
      if (index === this.basicdata.currentPage) {
      let style = {}
      style[&#39;transform&#39;] = &#39;translate3D(&#39; + this.temporaryData.poswidth + &#39;px&#39; + &#39;,&#39; + this.temporaryData.posheight + &#39;px&#39; + &#39;,0px)&#39;
      style[&#39;opacity&#39;] = 1
      style[&#39;zIndex&#39;] = 10
      return style
      }
     }
     }
    }
    </script>
    로그인 후 복사
  • 3. 조건 성공 시 슬라이드아웃, 조건 실패 시 리바운드

조건의 트리거 판단은 터치엔드/마우스업 이후에 수행됩니다. 여기서는 먼저 간단한 조건을 사용하여 판단하고 동시에 첫 번째 이미지 팝업 및 리바운드 효과를 제공합니다.

<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数据包含基础的图片数据
 pages: {
  type: Array,
  default: []
 }
 },
 data () {
 return {
  // basicdata数据包含组件基本数据
  basicdata: {
  start: {}, // 记录起始位置
  end: {}, // 记录终点位置
  currentPage: 0 // 默认首图的序列
  },
  // temporaryData数据包含组件临时数据
  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
  // 滑动结束,触发判断
  // 简单判断滑动宽度超出100像素时触发滑出
  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可见数量前滑块的样式
  if (index <= this.basicdata.currentPage + visible - 1) {
   style[&#39;opacity&#39;] = &#39;1&#39;
   style[&#39;transform&#39;] = &#39;translate3D(0,0,&#39; + -1 * perIndex * 60 + &#39;px&#39; + &#39;)&#39;
   style[&#39;zIndex&#39;] = visible - index + this.basicdata.currentPage
   style[&#39;transitionTimingFunction&#39;] = &#39;ease&#39;
   style[&#39;transitionDuration&#39;] = 300 + &#39;ms&#39;
  } else {
   style[&#39;zIndex&#39;] = &#39;-1&#39;
   style[&#39;transform&#39;] = &#39;translate3D(0,0,&#39; + -1 * visible * 60 + &#39;px&#39; + &#39;)&#39;
  }
  return style
  }
 },
 // 首页样式切换
 transformIndex (index) {
  // 处理3D效果
  if (index === this.basicdata.currentPage) {
  let style = {}
  style[&#39;transform&#39;] = &#39;translate3D(&#39; + this.temporaryData.poswidth + &#39;px&#39; + &#39;,&#39; + this.temporaryData.posheight + &#39;px&#39; + &#39;,0px)&#39;
  style[&#39;opacity&#39;] = this.temporaryData.opacity
  style[&#39;zIndex&#39;] = 10
  if (this.temporaryData.animation) {
   style[&#39;transitionTimingFunction&#39;] = &#39;ease&#39;
   style[&#39;transitionDuration&#39;] = 300 + &#39;ms&#39;
  }
  return style
  }
 }
 }
}
</script>
로그인 후 복사

4. 슬라이드하면 다음 사진이 위에 쌓이게 됩니다

리스태킹은 컴포넌트의 마지막 기능이자 가장 중요하고 복잡한 기능이기도 합니다. 우리 코드에서 스택 항목의 정렬은 바인딩 스타일의 변형 함수와 변형에 따라 달라집니다. 함수에서 결정된 조건은 currentPage를 변경하고 재스택을 완료하려면 +1해야 합니까? ?

대답은 그렇게 간단하지 않습니다. 슬라이드 아웃은 300ms가 소요되는 애니메이션 효과이고 currentPage 변경으로 인한 재배열이 즉시 변경되어 애니메이션 진행을 방해하기 때문입니다. 따라서 변환 함수의 정렬 조건을 먼저 수정한 후 currentPage를 변경해야 합니다.

#### 구체적인 구현

변환 함수 정렬 조건 수정

Let currentPage+

  • on

    TransitionEnd 이벤트

    추가, 슬라이드 아웃 종료 후 스택 목록으로 재배치

  • 코드는 다음과 같습니다:

    <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数据包含基础的图片数据
     pages: {
      type: Array,
      default: []
     }
     },
     data () {
     return {
      // basicdata数据包含组件基本数据
      basicdata: {
      start: {}, // 记录起始位置
      end: {}, // 记录终点位置
      currentPage: 0 // 默认首图的序列
      },
      // temporaryData数据包含组件临时数据
      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
      // 滑动结束,触发判断
      // 简单判断滑动宽度超出100像素时触发滑出
      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 引发排序变化
      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发生变化后,正在执行的动画滑动序列已经变为上一层
      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可见数量前滑块的样式
      if (index <= this.basicdata.currentPage + visible - 1) {
       style[&#39;opacity&#39;] = &#39;1&#39;
       style[&#39;transform&#39;] = &#39;translate3D(0,0,&#39; + -1 * perIndex * 60 + &#39;px&#39; + &#39;)&#39;
       style[&#39;zIndex&#39;] = visible - index + this.basicdata.currentPage
       style[&#39;transitionTimingFunction&#39;] = &#39;ease&#39;
       style[&#39;transitionDuration&#39;] = 300 + &#39;ms&#39;
      } else {
       style[&#39;zIndex&#39;] = &#39;-1&#39;
       style[&#39;transform&#39;] = &#39;translate3D(0,0,&#39; + -1 * visible * 60 + &#39;px&#39; + &#39;)&#39;
      }
      return style
      // 已滑动模块释放后
      } else if (index === this.basicdata.currentPage - 1) {
      let style = {}
      // 继续执行动画
      style[&#39;transform&#39;] = &#39;translate3D(&#39; + this.temporaryData.lastPosWidth + &#39;px&#39; + &#39;,&#39; + this.temporaryData.lastPosHeight + &#39;px&#39; + &#39;,0px)&#39;
      style[&#39;opacity&#39;] = &#39;0&#39;
      style[&#39;zIndex&#39;] = &#39;-1&#39;
      style[&#39;transitionTimingFunction&#39;] = &#39;ease&#39;
      style[&#39;transitionDuration&#39;] = 300 + &#39;ms&#39;
      return style
      }
     },
     // 首页样式切换
     transformIndex (index) {
      // 处理3D效果
      if (index === this.basicdata.currentPage) {
      let style = {}
      style[&#39;transform&#39;] = &#39;translate3D(&#39; + this.temporaryData.poswidth + &#39;px&#39; + &#39;,&#39; + this.temporaryData.posheight + &#39;px&#39; + &#39;,0px)&#39;
      style[&#39;opacity&#39;] = this.temporaryData.opacity
      style[&#39;zIndex&#39;] = 10
      if (this.temporaryData.animation) {
       style[&#39;transitionTimingFunction&#39;] = &#39;ease&#39;
       style[&#39;transitionDuration&#39;] = 300 + &#39;ms&#39;
      }
      return style
      }
     }
     }
    }
    </script>
    로그인 후 복사
    알았어~ 위의 4가지 단계를 완료하면 구성요소 쌓기의 기본 기능이 구현되었습니다. 와서 그 효과를 확인해 보세요

    이 기사의 사례를 읽으신 후 방법을 마스터하셨다고 생각합니다. 더 흥미로운 정보를 보려면 PHP 중국어 웹사이트의 다른 관련 기사를 주목하세요!

    추천 자료:

    Native가 fetch를 사용하여 이미지 업로드 기능을 구현하는 방법

    vue.js가 배열 위치를 이동하고 뷰를 실시간으로 업데이트합니다

위 내용은 Vue는 슬라이딩 스태킹 구성 요소를 구현합니다.의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
3 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

Windows 10 이전 버전 구성 요소 DirectPlay를 설치하는 방법 Windows 10 이전 버전 구성 요소 DirectPlay를 설치하는 방법 Dec 28, 2023 pm 03:43 PM

많은 사용자가 win10에서 일부 게임을 플레이할 때 화면이 멈추거나 화면이 흐려지는 등의 문제에 항상 직면합니다. 이때 다이렉트 플레이 기능을 켜면 문제를 해결할 수 있으며 기능 작동 방법도 매우 간단합니다. 이전 버전의 win10 컴포넌트 다이렉트플레이 설치 방법 1. 검색 상자에 "제어판"을 입력하고 엽니다. 2. 보기 방법으로 큰 아이콘을 선택합니다. 3. "프로그램 및 기능"을 찾습니다. 4. 활성화 또는 활성화하려면 왼쪽을 클릭합니다. Win 기능 끄기 5. 여기에서 이전 버전을 선택하세요. 확인란을 선택하세요.

Vue를 사용하여 캘린더 구성요소를 구현하는 방법은 무엇입니까? Vue를 사용하여 캘린더 구성요소를 구현하는 방법은 무엇입니까? Jun 25, 2023 pm 01:28 PM

Vue는 매우 인기 있는 프런트 엔드 프레임워크로, 개발자가 효율적이고 유연하며 유지 관리하기 쉬운 웹 애플리케이션을 구축하는 데 도움이 되는 구성 요소화, 데이터 바인딩, 이벤트 처리 등과 같은 많은 도구와 기능을 제공합니다. 이번 글에서는 Vue를 사용하여 캘린더 컴포넌트를 구현하는 방법을 소개하겠습니다. 1. 요구사항 분석 먼저 이 캘린더 구성요소의 요구사항을 분석해야 합니다. 기본 달력에는 다음과 같은 기능이 있어야 합니다. 이번 달의 달력 페이지를 표시하고 특정 날짜를 클릭하여 이전 달 또는 다음 달로 전환할 수 있도록 지원합니다.

VUE3 개발 기본 사항: 확장을 사용하여 구성 요소 상속 VUE3 개발 기본 사항: 확장을 사용하여 구성 요소 상속 Jun 16, 2023 am 08:58 AM

Vue는 현재 가장 인기 있는 프런트엔드 프레임워크 중 하나이며, VUE3은 Vue 프레임워크의 최신 버전입니다. VUE2에 비해 VUE3는 더 높은 성능과 더 나은 개발 경험을 제공하며 많은 개발자의 첫 번째 선택이 되었습니다. VUE3에서는 익스텐트를 사용하여 컴포넌트를 상속하는 것이 매우 실용적인 개발 방법입니다. 이 글에서는 익스텐트를 사용하여 컴포넌트를 상속하는 방법을 소개합니다. 확장이란 무엇입니까? Vue에서 확장은 매우 실용적인 속성으로, 하위 구성 요소가 상위 구성 요소로부터 상속받는 데 사용할 수 있습니다.

Angular 구성 요소 및 해당 표시 속성: 비블록 기본값 이해 Angular 구성 요소 및 해당 표시 속성: 비블록 기본값 이해 Mar 15, 2024 pm 04:51 PM

Angular 프레임워크의 구성 요소에 대한 기본 표시 동작은 블록 수준 요소에 대한 것이 아닙니다. 이 디자인 선택은 구성 요소 스타일의 캡슐화를 촉진하고 개발자가 각 구성 요소가 표시되는 방법을 의식적으로 정의하도록 장려합니다. CSS 속성 표시를 명시적으로 설정하면 Angular 구성 요소의 표시를 완전히 제어하여 원하는 레이아웃과 응답성을 얻을 수 있습니다.

휴대폰 화면이 미끄러지거나 건조해지면 어떻게 해야 하나요? 휴대폰 화면이 미끄러지거나 건조해지면 어떻게 해야 하나요? Dec 04, 2023 pm 03:51 PM

미끄러지거나 건조되기 어려운 휴대폰 화면에 대한 솔루션: 1. 화면을 정기적으로 청소합니다. 3. 손가락의 미끄러짐 강도를 높입니다. 4. 휴대폰 화면 보호 장치를 교체합니다. 6. 손을 촉촉하게 유지하십시오. 7. 필름을 붙일 때 깨끗하게 다루십시오. 8. 윤활제를 사용하십시오. 10. 화면 밝기를 조정하십시오. 자세한 소개: 1. 화면을 가습하고 화면 옆에 가습기를 두거나 물을 뿌려 공기 중 습도를 높여 화면의 건조함을 줄입니다. 2. 화면을 정기적으로 청소하고 전문 화면 세척제를 사용합니다.

이전 버전의 win10 구성 요소 설정을 여는 방법 이전 버전의 win10 구성 요소 설정을 여는 방법 Dec 22, 2023 am 08:45 AM

Win10 이전 버전 구성요소는 일반적으로 기본적으로 닫혀 있으므로 사용자가 직접 설정해야 합니다. 먼저 작업은 아래 단계를 따르기만 하면 됩니다. 1. 시작을 클릭한 다음 "Win 시스템"을 클릭합니다. 2. 클릭하여 제어판으로 들어갑니다. 3. 그런 다음 아래 프로그램을 클릭합니다. 4. "Win 기능 활성화 또는 끄기"를 클릭합니다. 5. 여기에서 원하는 것을 선택할 수 있습니다. 열기 위해

Vue가 JSX를 통해 구성 요소를 동적으로 렌더링하는 방법에 대해 이야기해 보겠습니다. Vue가 JSX를 통해 구성 요소를 동적으로 렌더링하는 방법에 대해 이야기해 보겠습니다. Dec 05, 2022 pm 06:52 PM

Vue는 JSX를 통해 어떻게 구성 요소를 동적으로 렌더링합니까? 다음 기사에서는 Vue가 JSX를 통해 구성 요소를 효율적으로 동적으로 렌더링하는 방법을 소개합니다. 도움이 되기를 바랍니다.

VSCode 플러그인 공유: Vue/React 구성요소의 실시간 미리보기를 위한 플러그인 VSCode 플러그인 공유: Vue/React 구성요소의 실시간 미리보기를 위한 플러그인 Mar 17, 2022 pm 08:07 PM

VSCode에서 Vue/React 구성 요소를 개발할 때 구성 요소를 실시간으로 미리 보는 방법은 무엇입니까? 이 기사에서는 VSCode의 Vue/React 구성 요소를 실시간으로 미리 볼 수 있는 플러그인을 공유하겠습니다. 도움이 되기를 바랍니다.

See all articles