Skip to content

引导子组件 xGuidItem ​


预览

介绍 ​

内部只可放置在x-guid内,遮罩、高亮环、提示卡都由它自己渲染。

平台兼容 ​

HarmonyH5andriodIOS小程序UTSUNIAPP-X SDKversion
☑☑☑️☑️☑️☑️4.87+1.1.21

文件路径 ​

ts

@/uni_modules/tmx-ui/components/x-guid-item/x-guid-item.uvue

使用 ​

ts

<x-guid-item></x-guid-item>

Props 属性 ​

名称说明类型默认值
targetId必填;唯一标识;且不可以动态变更;可以通过重新渲染变更id;这个是目标元素上的id,
且是唯一,必须在页面中,不可以封装在子组件内,也不可以隐藏中的元素id,
必须是明确且可见的元素id
string""
order必填;顺序索引,一般循环的index即可。
number0
title标题
string""
content内容描述
string""
bgColor提示卡的背景色
string"#000000"
darkBgColor提示卡的暗黑背景色,为空取bgColor
string""
color提示卡的文字色
string"#ffffff"
round提示卡圆角(px)
number12
maxWidth提示卡宽度(px);超过视口可用宽度时自动收窄
number350
titleSize标题字号(px)
number18
contentSize内容描述字号(px)
number14
gap提示卡与挖洞的间距(px)
number12
edge提示卡与屏幕边缘、挖洞的最小间距(px)
number12

Events 事件 ​

名称参数说明

Slots 插槽 ​

名称说明数据
title--

Ref 方法 ​

名称参数返回值说明

示例文件路径 ​

json

/pages/daohang/guid

示例源码 ​

uvue
vue
<template>
	<!-- activeId -->
	<!-- #ifdef MP-WEIXIN || MP-ALIPAY -->
	<page-meta :page-style="`background-color:${xThemeConfigBgColor}`">
		<navigation-bar :background-color="xThemeConfigNavBgColor"
			:front-color="xThemeConfigNavFontColor"></navigation-bar>
	</page-meta>
	<!-- #endif -->
	<x-sheet>
		<x-text font-size="18" class="text-weight-b mb-8">引导 xGuid {{activeId}}</x-text>
		<x-text color="#999999">引导组件,需要定位聚焦的元素必须在页面上不可以在子组件中或者隐藏中,并且必须要设定唯一id标识。蒸汽模式各端页面默认可滚动,目标不在可视区时组件会自动滚过去;页面若在pages.json里配置了disableScroll:true(自定义导航栏/tabbar),自动滚动会失败并告警,此时请自行保证目标可见或设置autoScroll=false。</x-text>
	</x-sheet>
	<view class="pa-12">
		<x-button color="primary" :block="true" @click="onStart">重新开始引导</x-button>
	</view>
	<view style="height:50px"></view>
	<view id="testId1" class="mx-16 mb-16 pa-16">
		<x-text font-size="18" class="text-weight-b mb-8">节点1 testId1</x-text>
		<view>
			<x-text color="#999999">testId1</x-text>
		</view>
	</view>
	<view style="height:200px"></view>
	<view id="testId2" class="mx-16 mb-16 pa-16">
		<x-text font-size="18" class="text-weight-b mb-8">节点2 testId2</x-text>
		<view>
			<x-text color="#999999">testId2</x-text>
		</view>
	</view>
	<view style="height:550px"></view>
	<x-sheet id="testId3">
		<x-text font-size="18" class="text-weight-b mb-8">节点3 testId3</x-text>
		<view>
			<x-text color="#999999">testId3</x-text>
		</view>
	</x-sheet>
	<view style="height:800px"></view>
	<view class="mx-16 mb-16 pa-16" id="testId4">
		<x-text font-size="18" class="text-weight-b mb-8">节点4 testId4</x-text>
		<view class="flex flex-row flex-row-center-end">
			<view>
				<x-text color="#999999">testId4(在屏幕外,验证自动滚动定位)</x-text>
			</view>
		</view>
	</view>
	<view style="height:200px"></view>
	<!--
	hole-padding:挖洞在目标基础上外扩,目标贴边时更好看
	ring-color / ring-width / hole-radius:高亮环,四块矩形遮罩做不出圆角洞,圆角由环呈现
	z-index:遮罩与提示卡的层级,页面有更高的固定层(底栏等)时可调大
	-->
	<x-guid v-model:activeId="activeId" defaultActiveId="testId1" :hole-padding="6" ring-color="primary"
		:ring-width="3" :hole-radius="8">
		<x-guid-item v-for="(item,index) in 4" :key="item" :order="index" :targetId="`testId${item}`"
			:title="`标题${item}`" :content="`testId${item}`"></x-guid-item>
	</x-guid>
</template>

<script lang="ts" setup>
	const activeId = ref('')
	
	const onStart = () => {
		activeId.value = 'testId1'
	}
</script>

<style lang="scss">
</style>
最近更新
稳定tokens