From bd99a5211f3a5fcaa051e5da868d87bb870148f5 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Fri, 01 Mar 2024 09:58:45 +0800
Subject: [PATCH] fix:手持设备

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

diff --git a/uni_modules/uview-ui/components/u-index-item/u-index-item.vue b/uni_modules/uview-ui/components/u-index-item/u-index-item.vue
new file mode 100644
index 0000000..0bc7fb3
--- /dev/null
+++ b/uni_modules/uview-ui/components/u-index-item/u-index-item.vue
@@ -0,0 +1,87 @@
+<template>
+	<!-- #ifdef APP-NVUE -->
+	<cell ref="u-index-item">
+		<!-- #endif -->
+		<view
+			class="u-index-item"
+			:id="`u-index-item-${id}`"
+			:class="[`u-index-item-${id}`]"
+		>
+			<slot />
+		</view>
+		<!-- #ifdef APP-NVUE -->
+	</cell>
+	<!-- #endif -->
+</template>
+
+<script>
+	import props from './props.js';
+	// #ifdef APP-NVUE
+	// ������weex������������KPI���������������������������������������������������������������������������dom���������������������
+	const dom = uni.requireNativePlugin('dom')
+	// #endif
+	/**
+	 * IndexItem 
+	 * @description 
+	 * @tutorial https://uviewui.com/components/indexList.html
+	 * @property {String}
+	 * @event {Function}
+	 * @example
+	 */
+	export default {
+		name: 'u-index-item',
+		mixins: [uni.$u.mpMixin, uni.$u.mixin,props],
+		data() {
+			return {
+				// ������������������������������������
+				top: 0,
+				height: 0,
+				id: ''
+			}
+		},
+		created() {
+			// ���������u-index-anchor���������
+			this.anchor = {}
+		},
+		mounted() {
+			this.init()
+		},
+		methods: {
+			init() {
+				// ������������������������������������������������������parent������
+				this.getParentData('u-index-list')
+				if (!this.parent) {
+					return uni.$u.error('u-index-item���������������u-index-list������������')
+				}
+				uni.$u.sleep().then(() =>{
+					this.getIndexItemRect().then(size => {
+						// ������������������������������������������������������������������children���������������������top������������������������������������
+						this.top = Math.ceil(size.top)
+						this.height = Math.ceil(size.height)
+					})
+				})
+			},
+			getIndexItemRect() {
+				return new Promise(resolve => {
+					// #ifndef APP-NVUE
+					this.$uGetRect('.u-index-item').then(size => {
+						resolve(size)
+					})
+					// #endif
+
+					// #ifdef APP-NVUE
+					const ref = this.$refs['u-index-item']
+					dom.getComponentRect(ref, res => {
+						resolve(res.size)
+					})
+					// #endif
+				}) 
+			}
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import "../../libs/css/components.scss";
+	
+</style>

--
Gitblit v1.8.0