From 66d2c8d8c97e19fdbd969f97dd3d6a28f27c415f Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Wed, 01 Nov 2023 16:07:03 +0800
Subject: [PATCH] fix:小程序分享功能和秒级数据

---
 uni_modules/uview-ui/components/u-index-anchor/u-index-anchor.vue |   91 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 91 insertions(+), 0 deletions(-)

diff --git a/uni_modules/uview-ui/components/u-index-anchor/u-index-anchor.vue b/uni_modules/uview-ui/components/u-index-anchor/u-index-anchor.vue
new file mode 100644
index 0000000..b95ddef
--- /dev/null
+++ b/uni_modules/uview-ui/components/u-index-anchor/u-index-anchor.vue
@@ -0,0 +1,91 @@
+<template>
+	<!-- #ifdef APP-NVUE -->
+	<header>
+	<!-- #endif -->
+	<view
+	    class="u-index-anchor u-border-bottom"
+		:ref="`u-index-anchor-${text}`"
+	    :style="{
+			height: $u.addUnit(height),
+			backgroundColor: bgColor
+		}"
+	>
+		<text
+		    class="u-index-anchor__text"
+		    :style="{
+				fontSize: $u.addUnit(size),
+				color: color
+			}"
+		>{{ text }}</text>
+	</view>
+	<!-- #ifdef APP-NVUE -->
+	</header>
+	<!-- #endif -->
+</template>
+
+<script>
+	import props from './props.js';
+	// #ifdef APP-NVUE
+	const dom = uni.requireNativePlugin('dom')
+	// #endif
+	/**
+	 * IndexAnchor ������������
+	 * @description 
+	 * @tutorial https://uviewui.com/components/indexList.html
+	 * @property {String | Number}	text	������������������������
+	 * @property {String}			color	������������������������ ( ������ '#606266' )
+	 * @property {String | Number}	size	���������������������������������������px ( ������ 14 )
+	 * @property {String}			bgColor	������������������������ ( ������ '#dedede' )
+	 * @property {String | Number}	height	���������������������������������px ( ������ 32 )
+	 * @example <u-index-anchor :text="indexList[index]"></u-index-anchor>
+	 */
+	export default {
+		name: 'u-index-anchor',
+		mixins: [uni.$u.mpMixin, uni.$u.mixin,props],
+		data() {
+			return {
+			}
+		},
+		mounted() {
+			this.init()
+		},
+		methods: {
+			init() {
+				// ������������������������������������������������������parent������
+				const indexList = uni.$u.$parent.call(this, 'u-index-list')
+				if (!indexList) { 
+					return uni.$u.error('u-index-anchor���������������u-index-list������������')
+				}
+				// ������������������������u-index-list���
+				indexList.anchors.push(this)
+				const indexListItem = uni.$u.$parent.call(this, 'u-index-item')
+				// #ifndef APP-NVUE
+				// ������������nvue������u-index-anchor���������������u-index-item������
+				if (!indexListItem) {
+					return uni.$u.error('u-index-anchor���������������u-index-item������������')
+				}
+				// ������u-index-item���id���anchor���text���������������������nvue���������������������������scroll-view������������������������
+				indexListItem.id = this.text.charCodeAt(0)
+				// #endif
+			}
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import "../../libs/css/components.scss";
+
+	.u-index-anchor {
+		position: sticky;
+		top: 0;
+		@include flex;
+		align-items: center;
+		padding-left: 15px;
+		z-index: 1;
+
+		&__text {
+			@include flex;
+			align-items: center;
+		}
+	}
+</style>

--
Gitblit v1.8.0