vue.js - 如何在Vue(Quasar)中以简单的方式删除轮播中的箭头

标签 vue.js vuejs2 vuejs3 quasar-framework quasar

这是我需要的条件:

如果只有一张图片,两边不要显示箭头即可;如果有多个,则显示它。

或者您可以在 https://quasar.dev/vue-components/carousel 中找到它

<template>
    <div class="q-pa-md">
        <q-carousel
           swipeable
           animated
      arrows
      v-model="slide"
      v-model:fullscreen="fullscreen"
      infinite
    >
      <q-carousel-slide :name="1" img-src="https://cdn.quasar.dev/img/mountains.jpg" />
      <q-carousel-slide :name="2" img-src="https://cdn.quasar.dev/img/parallax1.jpg" />
      <q-carousel-slide :name="3" img-src="https://cdn.quasar.dev/img/parallax2.jpg" />
      <q-carousel-slide :name="4" img-src="https://cdn.quasar.dev/img/quasar.jpg" />

      <template v-slot:control>
        <q-carousel-control
          position="bottom-right"
          :offset="[18, 18]"
        >
          <q-btn
            push round dense color="white" text-color="primary"
            :icon="fullscreen ? 'fullscreen_exit' : 'fullscreen'"
            @click="fullscreen = !fullscreen"
          />
        </q-carousel-control>
      </template>
    </q-carousel>
  </div>
</template>

<script>
import { ref } from 'vue'

export default {
  setup () {
    return {
      slide: ref(1),
      fullscreen: ref(false)
    }
  }
}
</script>

最佳答案

Make an array of images and write this:

:arrows="photos.length > 1"

关于vue.js - 如何在Vue(Quasar)中以简单的方式删除轮播中的箭头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72899467/

相关文章:

vue.js - vue中如何调整图片大小

javascript - 如何在 SweetAlert2 html 输出中使用 v-for

javascript - 为什么这个 Vue 3 表单验证脚本失败?

node.js - 如何在 nuxt js 中使用 vuetify 作为插件?

javascript - ESLint 和 Vue - 如何禁止使用 `$log`?

javascript - vue.js 滑动条如何更改值

reactjs - 如何在 Vue 生态系统之外使用 Vue 3 react 对象

typescript - Vite 在 main.ts 中使用别名导入 CSS

Vue.js Prop 同步修改器不更新父组件

javascript - Vuejs - 更改从外部选择中的选定选项