From d1448cb0ef10f358bb7bddb4e1ec268515e0b787 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 15 七月 2025 11:46:57 +0800
Subject: [PATCH] 项目初始化

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

diff --git a/uni_modules/uview-ui/components/u-row/u-row.vue b/uni_modules/uview-ui/components/u-row/u-row.vue
new file mode 100644
index 0000000..e608fc5
--- /dev/null
+++ b/uni_modules/uview-ui/components/u-row/u-row.vue
@@ -0,0 +1,93 @@
+<template>
+	<view
+	    class="u-row"
+		ref="u-row"
+	    :style="[rowStyle]"
+	    @tap="clickHandler"
+	>
+		<slot />
+	</view>
+</template>
+
+<script>
+	// #ifdef APP-NVUE
+	const dom = uni.requireNativePlugin('dom')
+	// #endif
+	import props from './props.js';
+	/**
+	 * Row 鏍呮牸绯荤粺涓殑琛�
+	 * @description 閫氳繃鍩虹鐨� 12 鍒嗘爮锛岃繀閫熺畝渚垮湴鍒涘缓甯冨眬 
+	 * @tutorial https://www.uviewui.com/components/layout.html
+	 * @property {String | Number}	gutter		鏍呮牸闂撮殧锛屽乏鍙冲悇涓烘鍊肩殑涓�鍗婏紝鍗曚綅px  (榛樿 0 )
+	 * @property {String}			justify		姘村钩鎺掑垪鏂瑰紡(寰俊灏忕▼搴忔殏涓嶆敮鎸�) 鍙�夊�间负`start`(鎴朻flex-start`)銆乣end`(鎴朻flex-end`)銆乣center`銆乣around`(鎴朻space-around`)銆乣between`(鎴朻space-between`)  (榛樿 'start' )
+	 * @property {String}			align		鍨傜洿鎺掑垪鏂瑰紡 (榛樿 'center' )
+	 * @property {Object}			customStyle	瀹氫箟闇�瑕佺敤鍒扮殑澶栭儴鏍峰紡
+	 * 
+	 * @event {Function} click row琚偣鍑�
+	 * @example <u-row justify="space-between" customStyle="margin-bottom: 10px"></u-row>
+	 */
+	export default {
+		name: "u-row",
+		mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
+		data() {
+			return {
+				
+			}
+		},
+		computed: {
+			uJustify() {
+				if (this.justify == 'end' || this.justify == 'start') return 'flex-' + this.justify
+				else if (this.justify == 'around' || this.justify == 'between') return 'space-' + this.justify
+				else return this.justify
+			},
+			uAlignItem() {
+				if (this.align == 'top') return 'flex-start'
+				if (this.align == 'bottom') return 'flex-end'
+				else return this.align
+			},
+			rowStyle() {
+				const style = {
+					alignItems: this.uAlignItem,
+					justifyContent: this.uJustify
+				}
+				// 閫氳繃缁檜-row宸﹀彸涓よ竟鐨勮礋澶栬竟璺濓紝娑堥櫎u-col鍦ㄦ湁gutter鏃讹紝绗竴涓拰鏈�鍚庝竴涓厓绱犵殑宸﹀唴杈硅窛鍜屽彸鍐呰竟璺濋�犳垚鐨勫奖鍝�
+				if(this.gutter) {
+					style.marginLeft = uni.$u.addUnit(-Number(this.gutter)/2)
+					style.marginRight = uni.$u.addUnit(-Number(this.gutter)/2)
+				}
+				return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
+			}
+		},
+		methods: {
+			clickHandler(e) {
+				this.$emit('click')
+			},
+			async getComponentWidth() {
+				// 寤舵椂涓�瀹氭椂闂达紝浠ョ‘淇濊妭鐐规覆鏌撳畬鎴�
+				await uni.$u.sleep()
+				return new Promise(resolve => {
+					// uView灏佽鐨勮幏鍙栬妭鐐圭殑鏂规硶锛岃瑙佹枃妗�
+					// #ifndef APP-NVUE
+					this.$uGetRect('.u-row').then(res => {
+						resolve(res.width)
+					})
+					// #endif
+					// #ifdef APP-NVUE
+					// nvue鐨刣om妯″潡鐢ㄤ簬鑾峰彇鑺傜偣
+					dom.getComponentRect(this.$refs['u-row'], (res) => {
+						resolve(res.size.width)
+					})
+					// #endif
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import "../../libs/css/components.scss";
+	
+	.u-row {
+		@include flex;
+	}
+</style>

--
Gitblit v1.9.3