<template>
  <div class="directive-wrapper">
    <div class="leftDir" @click="prevItem">&lt;</div>
    <div class="rightDir" @click="nextItem">&gt;</div>
  </div>
</template>

<script>
export default {
  name: "Directive",
  setup(props, ctx) {
    /*
     *上一页
     */
    const prevItem = () => {
      ctx.emit("dirClick", "prev");
    };
    /*
     *下一页
     */
    const nextItem = () => {
      ctx.emit("dirClick", "next");
    };

    return {
      prevItem,
      nextItem
    };
  },
};
</script>

<style lang="scss" scoped>
.directive-wrapper {
  width: 100%;
  height: 100%;
  position: absolute;
  font-size: 30px;
  opacity: .5;
  .leftDir {
    position: absolute;
    z-index: 2;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
  }
  .rightDir {
    position: absolute;
    z-index: 2;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
  }
}
</style>