如何在 Vue(Nuxt) 中使用图像作为 Vue 轮播的导航标签?
How can I use images as navigation labels for Vue carousel in Vue(Nuxt)?
我正在使用 Vue 轮播(https://github.com/SSENSE/vue-carousel)。我想使用 navigationNextLabel
和 navigationPrevLabel
作为图像。意思是,我有 2 张图像,即 previous_arrow.png
和 next_arrow.png
,我想单击它们以滑过此旋转木马。
但我不知道如何在 :navigationNextLabel
和 :navigationPrevLabel
中嵌入图像。这是我目前所拥有的:
<template>
<carousel
:per-page="1"
:mouse-drag="true"
:navigation-enabled="true"
:navigation-next-label="<div><img src="../assets/next_arrow.png" class="w-12 h-12" /></div>"
:navigation-previous-label="<div><img src="../assets/previous_arrow.png" class="w-12 h-12"/></div>"
>
<slide> Slide content 1 </slide>
<slide> Slide content 2 </slide>
<slide> Slide content 3 </slide>
</carousel>
</template>
<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
@Component
export default class Gallery extends Vue {
@Prop() 'navigationEnabled'!: string;
@Prop() 'navigationNextLabel'!: string;
@Prop() 'navigationPreviousLabel'!: string;
}
</script>
我得到的错误:'v-bind' directives require an attribute value.
希望得到一些帮助。谢谢!
可以使用 CSS 代替标签 html。当然不要忘记隐藏默认按钮html。
.VueCarousel-navigation-button::before {
content: "";
position: absolute;
top: 8px;
height: 25px;
width: 25px;
}
.VueCarousel-navigation-next::before {
background: url('../assets/previous_arrow.png');
right: 6px;
}
.VueCarousel-navigation-prev::before {
background: url('../assets/previous_arrow.png');
left: 6px;
}
我正在使用 Vue 轮播(https://github.com/SSENSE/vue-carousel)。我想使用 navigationNextLabel
和 navigationPrevLabel
作为图像。意思是,我有 2 张图像,即 previous_arrow.png
和 next_arrow.png
,我想单击它们以滑过此旋转木马。
但我不知道如何在 :navigationNextLabel
和 :navigationPrevLabel
中嵌入图像。这是我目前所拥有的:
<template>
<carousel
:per-page="1"
:mouse-drag="true"
:navigation-enabled="true"
:navigation-next-label="<div><img src="../assets/next_arrow.png" class="w-12 h-12" /></div>"
:navigation-previous-label="<div><img src="../assets/previous_arrow.png" class="w-12 h-12"/></div>"
>
<slide> Slide content 1 </slide>
<slide> Slide content 2 </slide>
<slide> Slide content 3 </slide>
</carousel>
</template>
<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
@Component
export default class Gallery extends Vue {
@Prop() 'navigationEnabled'!: string;
@Prop() 'navigationNextLabel'!: string;
@Prop() 'navigationPreviousLabel'!: string;
}
</script>
我得到的错误:'v-bind' directives require an attribute value.
希望得到一些帮助。谢谢!
可以使用 CSS 代替标签 html。当然不要忘记隐藏默认按钮html。
.VueCarousel-navigation-button::before {
content: "";
position: absolute;
top: 8px;
height: 25px;
width: 25px;
}
.VueCarousel-navigation-next::before {
background: url('../assets/previous_arrow.png');
right: 6px;
}
.VueCarousel-navigation-prev::before {
background: url('../assets/previous_arrow.png');
left: 6px;
}