VueJS 巡回赛
武杰斯语Name Tour是一个轻量级,简单而可定制的Tour插件. 它为引导您的用户通过应用程序提供了快速而简单的方式.
目录
先决条件
安装
[TIP] 在找新版本吗? Nuxt版本(特别感谢 BayBreezy)
创建巡演
在您的应用程序中加入 VueJS 旅游组件 。 建议添加到 App.vue
并使用 <script setup> 语法.
<template>
<div>
<div id="selectByID">Selected by its id 'selectByID'</div>
<p class="selectByClass">Telected by its class 'selectByClass'</p>
<button data-step="3">Selected by the 'data-step="3"' attribute</button>
<VTour :steps="steps"/>
</div>
</template>
<script setup>
const steps = [
{
target: '#selectByID',
content: 'This is the first step',
},
{
target: '.selectByClass',
content: 'This is the second step, placed on the bottom of the target',
placement: 'bottom',
},
{
target: '[data-step="3"]',
content: 'This is the third step',
}
];
</script>
开始巡演
要开始巡演,你可以使用 autoStart 道具...
<template>
<div>
<div id="selectByID">Selected by its id 'selectByID'</div>
<p class="selectByClass">Telected by its class 'selectByClass'</p>
<button data-step="3">Selected by the 'data-step="3"' attribute</button>
<VTour :steps="steps" autoStart/>
</div>
</template>
<script setup>
const steps = [...];
</script>
...或者打电话 startTour() 用于组件实例的方法.
<template>
<div>
<div id="selectByID">Selected by its id 'selectByID'</div>
<p class="selectByClass">Telected by its class 'selectByClass'</p>
<button data-step="3">Selected by the 'data-step="3"' attribute</button>
<VTour ref="tour" :steps="steps"/>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
const tour = ref(null);
const steps = [...];
onMounted(() => {
tour.value.startTour();
});
</script>
这个 target 步骤对象的属性可以是任何有效的 CSS 选择器。 。 。 .
文档
关于现有道具和方法的更多信息,请查看 文档。 。 。 .
有东西不见了吗?
如果您有特性请求或发现错误, 告诉我们 提交问题.
