From 68c5ef7d9fea3f911e250fb5f8b300bc76099e49 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 26 十月 2023 13:55:49 +0800
Subject: [PATCH] 小程序
---
minipro_standard/uni_modules/uview-ui/components/u-row/u-row.vue | 93 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/minipro_standard/uni_modules/uview-ui/components/u-row/u-row.vue b/minipro_standard/uni_modules/uview-ui/components/u-row/u-row.vue
index e69de29..e608fc5 100644
--- a/minipro_standard/uni_modules/uview-ui/components/u-row/u-row.vue
+++ b/minipro_standard/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