Skip to content
本页导读

Guide

组件类型:UxGuideComponentPublicInstance

支持动画效果,支持跳过和插槽自定义

平台兼容性

UniApp X

AndroidiOSweb鸿蒙 Next小程序
x

UniApp Vue Nvue

AndroidiOSweb鸿蒙 Next小程序
xxxx

Props

属性名类型默认值说明
defaultSlot默认插槽
datasArray数据
widthAny300宽度
skipBooleantrue跳过
offsetAny5偏移
opacityNumber0.8遮罩透明度0-1
confirmTextString'完成'完成按钮文字
autoscrollBooleantrue自动滚动到锚点

Events

事件名说明参数
scroll锚点无法触达需要滚动时触发
change步骤改变时触发
skip跳过时触发
end结束时触发

示例代码

html
<template>
	<ux-page :stack="showDoc">
		<ux-navbar :title="title" :border="false">
			<template v-slot:right>
				<!-- #ifndef MP -->
				<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
				<!-- #endif -->
			</template>
		</ux-navbar>
		
		<ux-scroll :scrollTop="scrollTop">
			<ux-card class="gtag" direction="column" icon="flag-filled" title="引导" :bold="true">
				<ux-text text="支持动画效果,支持跳过和插槽自定义"></ux-text>
			</ux-card>
			
			<ux-card class="gtag" direction="column" icon="arrowright" title="标题" :bold="true">
				<view id="step1">
					<ux-placeholder :height="100">
						<ux-row justify="center" align="center" style="height: 100%;">
							<ux-text prefix-icon="soapbubble-filled" text="节点1"></ux-text>
						</ux-row>
					</ux-placeholder>
				</view>
			</ux-card>
			
			<ux-card class="gtag" direction="column" icon="arrowright" title="标题" :bold="true">
				<ux-placeholder :height="100">
					<ux-row justify="center" align="center" style="height: 100%;">
						<view id="step2">
							<ux-text prefix-icon="soapbubble-filled" text="节点2"></ux-text>
						</view>
					</ux-row>
				</ux-placeholder>
			</ux-card>
			
			<ux-card class="gtag" direction="column" icon="arrowright" title="标题" :bold="true">
				<ux-placeholder :height="100">
					<ux-row justify="right" align="center" style="height: 100%;">
						<view id="step3">
							<ux-text prefix-icon="soapbubble-filled" text="节点3"></ux-text>
						</view>
					</ux-row>
				</ux-placeholder>
			</ux-card>
			
			<ux-card class="gtag" direction="column" icon="arrowright" title="标题" :bold="true">
				<view id="step4">
					<ux-placeholder :height="100">
						<ux-row justify="center" align="center" style="height: 100%;">
							<ux-text prefix-icon="soapbubble-filled" text="节点4"></ux-text>
						</ux-row>
					</ux-placeholder>
				</view>
			</ux-card>
			
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
				</ux-row>
			</ux-placeholder>
		</ux-scroll>
		
		<ux-guide v-if="showGuide" ref="uxGuideRef" :datas="guides" confirm-text="开启新的旅程" @scroll="scroll" @skip="end" @end="end" @change="change"></ux-guide>
	</ux-page>
</template>
<template>
	<ux-page :stack="showDoc">
		<ux-navbar :title="title" :border="false">
			<template v-slot:right>
				<!-- #ifndef MP -->
				<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
				<!-- #endif -->
			</template>
		</ux-navbar>
		
		<ux-scroll :scrollTop="scrollTop">
			<ux-card class="gtag" direction="column" icon="flag-filled" title="引导" :bold="true">
				<ux-text text="支持动画效果,支持跳过和插槽自定义"></ux-text>
			</ux-card>
			
			<ux-card class="gtag" direction="column" icon="arrowright" title="标题" :bold="true">
				<view id="step1">
					<ux-placeholder :height="100">
						<ux-row justify="center" align="center" style="height: 100%;">
							<ux-text prefix-icon="soapbubble-filled" text="节点1"></ux-text>
						</ux-row>
					</ux-placeholder>
				</view>
			</ux-card>
			
			<ux-card class="gtag" direction="column" icon="arrowright" title="标题" :bold="true">
				<ux-placeholder :height="100">
					<ux-row justify="center" align="center" style="height: 100%;">
						<view id="step2">
							<ux-text prefix-icon="soapbubble-filled" text="节点2"></ux-text>
						</view>
					</ux-row>
				</ux-placeholder>
			</ux-card>
			
			<ux-card class="gtag" direction="column" icon="arrowright" title="标题" :bold="true">
				<ux-placeholder :height="100">
					<ux-row justify="right" align="center" style="height: 100%;">
						<view id="step3">
							<ux-text prefix-icon="soapbubble-filled" text="节点3"></ux-text>
						</view>
					</ux-row>
				</ux-placeholder>
			</ux-card>
			
			<ux-card class="gtag" direction="column" icon="arrowright" title="标题" :bold="true">
				<view id="step4">
					<ux-placeholder :height="100">
						<ux-row justify="center" align="center" style="height: 100%;">
							<ux-text prefix-icon="soapbubble-filled" text="节点4"></ux-text>
						</ux-row>
					</ux-placeholder>
				</view>
			</ux-card>
			
			<ux-placeholder :height="200">
				<ux-row justify="center" align="center" style="height: 100%;">
					<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
				</ux-row>
			</ux-placeholder>
		</ux-scroll>
		
		<ux-guide v-if="showGuide" ref="uxGuideRef" :datas="guides" confirm-text="开启新的旅程" @scroll="scroll" @skip="end" @end="end" @change="change"></ux-guide>
	</ux-page>
</template>
ts
<script setup>
	import * as plus from '@/uni_modules/ux-plus'
	
	import { UxGuideItem } from '@/uni_modules/ux-frame'
	
	const scrollTop = ref(0)
	
	const uxGuideRef = ref<UxGuideComponentPublicInstance | null>(null)
	
	const guides = [{
		id: 'step1',
		text: '1. 适配深色模式,可随系统自动切换'
	},{
		id: 'step2',
		text: '2. 支持配置主色调'
	},{
		id: 'step3',
		text: '3. 支持字体大小、字体颜色、内边距、外边距等20+项配置'
	},{
		id: 'step4',
		text: '4. 持续更新的高性能UI组件库'
	}] as UxGuideItem[]
	
	const showGuide = ref(true)
	
	const title = ref('')
	
	function scroll(top: number) {
		scrollTop.value = top
	}
	
	function change(step: number) {
		console.log(step);
	}
	
	function end(step: number) {
		showGuide.value = false
	}
	
	const showDoc = ref(false)
	
	function onDoc() {
		plus.openWeb({
			title: '在线文档',
			url: 'https://www.uxframe.cn/component/guide.html',
			// blur: 1,
			success: () => {
				showDoc.value = true
			},
			complete: () => {
				showDoc.value = false
			}
		})
	}
	
	onLoad((e) => {
		title.value = e['title'] ?? ''
	})
</script>
<script setup>
	import * as plus from '@/uni_modules/ux-plus'
	
	import { UxGuideItem } from '@/uni_modules/ux-frame'
	
	const scrollTop = ref(0)
	
	const uxGuideRef = ref<UxGuideComponentPublicInstance | null>(null)
	
	const guides = [{
		id: 'step1',
		text: '1. 适配深色模式,可随系统自动切换'
	},{
		id: 'step2',
		text: '2. 支持配置主色调'
	},{
		id: 'step3',
		text: '3. 支持字体大小、字体颜色、内边距、外边距等20+项配置'
	},{
		id: 'step4',
		text: '4. 持续更新的高性能UI组件库'
	}] as UxGuideItem[]
	
	const showGuide = ref(true)
	
	const title = ref('')
	
	function scroll(top: number) {
		scrollTop.value = top
	}
	
	function change(step: number) {
		console.log(step);
	}
	
	function end(step: number) {
		showGuide.value = false
	}
	
	const showDoc = ref(false)
	
	function onDoc() {
		plus.openWeb({
			title: '在线文档',
			url: 'https://www.uxframe.cn/component/guide.html',
			// blur: 1,
			success: () => {
				showDoc.value = true
			},
			complete: () => {
				showDoc.value = false
			}
		})
	}
	
	onLoad((e) => {
		title.value = e['title'] ?? ''
	})
</script>
css
<style lang="scss">
	
</style>
<style lang="scss">
	
</style>