From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目

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

diff --git a/uview-ui/components/u-index-anchor/u-index-anchor.vue b/uview-ui/components/u-index-anchor/u-index-anchor.vue
new file mode 100644
index 0000000..bcd8bbf
--- /dev/null
+++ b/uview-ui/components/u-index-anchor/u-index-anchor.vue
@@ -0,0 +1,89 @@
+<template>
+	<!-- 鏀粯瀹濆皬绋嬪簭浣跨敤$u.getRect()鑾峰彇缁勪欢鐨勬牴鍏冪礌灏哄锛屾墍浠ュ湪澶栭潰濂椾竴涓�"澹�" -->
+	<view>
+		<view class="u-index-anchor-wrapper" :id="$u.guid()" :style="[wrapperStyle]">
+			<view class="u-index-anchor " :class="[active ? 'u-index-anchor--active' : '']" :style="[customAnchorStyle]">
+				<slot v-if="useSlot" />
+				<block v-else>
+					<text>{{ index }}</text>
+				</block>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	/**
+	 * indexAnchor 绱㈠紩鍒楄〃閿氱偣
+	 * @description 閫氳繃鎶樺彔闈㈡澘鏀剁撼鍐呭鍖哄煙,鎼厤<u-index-anchor>浣跨敤
+	 * @tutorial https://www.uviewui.com/components/indexList.html#indexanchor-props
+	 * @property {Boolean} use-slot 鏄惁浣跨敤鑷畾涔夊唴瀹圭殑鎻掓Ы锛堥粯璁alse锛�
+	 * @property {String Number} index 绱㈠紩瀛楃锛屽鏋滃畾涔変簡use-slot锛屾鍙傛暟鑷姩澶辨晥
+	 * @property {Object} custStyle 鑷畾涔夋牱寮忥紝瀵硅薄褰㈠紡锛屽"{color: 'red'}"
+	 * @event {Function} default 閿氱偣浣嶇疆鏄剧ず鍐呭锛岄粯璁や负绱㈠紩瀛楃
+	 * @example <u-index-anchor :index="item" />
+	 */
+	export default {
+		name: "u-index-anchor",
+		props: {
+			useSlot: {
+				type: Boolean,
+				default: false
+			},
+			index: {
+				type: String,
+				default: ''
+			},
+			customStyle: {
+				type: Object,
+				default () {
+					return {}
+				}
+			}
+		},
+		data() {
+			return {
+				active: false,
+				wrapperStyle: {},
+				anchorStyle: {}
+			}
+		},
+		created() {
+			this.parent = false;
+		},
+		mounted() {
+			this.parent = this.$u.$parent.call(this, 'u-index-list');
+			if(this.parent) {
+				this.parent.children.push(this);
+				this.parent.updateData();
+			}
+		},
+		computed: {
+			customAnchorStyle() {
+				return Object.assign(this.anchorStyle, this.customStyle);
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import "../../libs/css/style.components.scss";
+	
+	.u-index-anchor {
+		box-sizing: border-box;
+		padding: 14rpx 24rpx;
+		color: #606266;
+		width: 100%;
+		font-weight: 500;
+		font-size: 28rpx;
+		line-height: 1.2;
+		background-color: rgb(245, 245, 245);
+	}
+
+	.u-index-anchor--active {
+		right: 0;
+		left: 0;
+		color: #497bff;
+		background-color: #fff;
+	}
+</style>

--
Gitblit v1.9.3