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-checkbox-group/u-checkbox-group.vue |  123 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 123 insertions(+), 0 deletions(-)

diff --git a/uview-ui/components/u-checkbox-group/u-checkbox-group.vue b/uview-ui/components/u-checkbox-group/u-checkbox-group.vue
new file mode 100644
index 0000000..028da26
--- /dev/null
+++ b/uview-ui/components/u-checkbox-group/u-checkbox-group.vue
@@ -0,0 +1,123 @@
+<template>
+	<view class="u-checkbox-group u-clearfix">
+		<slot></slot>
+	</view>
+</template>
+
+<script>
+	import Emitter from '../../libs/util/emitter.js';
+	/**
+	 * checkboxGroup 寮�鍏抽�夋嫨鍣ㄧ埗缁勪欢Group
+	 * @description 澶嶉�夋缁勪欢涓�鑸敤浜庨渶瑕佸涓�夋嫨鐨勫満鏅紝璇ョ粍浠跺姛鑳藉畬鏁达紝浣跨敤鏂逛究
+	 * @tutorial https://www.uviewui.com/components/checkbox.html
+	 * @property {String Number} max 鏈�澶氳兘閫変腑澶氬皯涓猚heckbox锛堥粯璁�999锛�
+	 * @property {String Number} size 缁勪欢鏁翠綋鐨勫ぇ灏忥紝鍗曚綅rpx锛堥粯璁�40锛�
+	 * @property {Boolean} disabled 鏄惁绂佺敤鎵�鏈塩heckbox锛堥粯璁alse锛�
+	 * @property {String Number} icon-size 鍥炬爣澶у皬锛屽崟浣峳px锛堥粯璁�20锛�
+	 * @property {Boolean} label-disabled 鏄惁绂佹鐐瑰嚮鏂囨湰鎿嶄綔checkbox(榛樿false)
+	 * @property {String} width 瀹藉害锛岄渶甯﹀崟浣�
+	 * @property {String} width 瀹藉害锛岄渶甯﹀崟浣�
+	 * @property {String} shape 澶栬褰㈢姸锛宻hape-鏂瑰舰锛宑ircle-鍦嗗舰(榛樿circle)
+	 * @property {Boolean} wrap 鏄惁姣忎釜checkbox閮芥崲琛岋紙榛樿false锛�
+	 * @property {String} active-color 閫変腑鏃剁殑棰滆壊锛屽簲鐢ㄥ埌鎵�鏈夊瓙Checkbox缁勪欢锛堥粯璁�#497bff锛�
+	 * @event {Function} change 浠讳竴涓猚heckbox鐘舵�佸彂鐢熷彉鍖栨椂瑙﹀彂锛屽洖璋冧负涓�涓璞�
+	 * @example <u-checkbox-group></u-checkbox-group>
+	 */
+	export default {
+		name: 'u-checkbox-group',
+		mixins: [Emitter],
+		props: {
+			// 鏈�澶氳兘閫変腑澶氬皯涓猚heckbox
+			max: {
+				type: [Number, String],
+				default: 999
+			},
+			// 鎵�鏈夐�変腑椤圭殑 name
+			// value: {
+			// 	default: Array,
+			// 	default() {
+			// 		return []
+			// 	}
+			// },
+			// 鏄惁绂佺敤鎵�鏈夊閫夋
+			disabled: {
+				type: Boolean,
+				default: false
+			},
+			// 鍦ㄨ〃鍗曞唴鎻愪氦鏃剁殑鏍囪瘑绗�
+			name: {
+				type: [Boolean, String],
+				default: ''
+			},
+			// 鏄惁绂佹鐐瑰嚮鎻愮ず璇�変腑澶嶉�夋
+			labelDisabled: {
+				type: Boolean,
+				default: false
+			},
+			// 褰㈢姸锛宻quare涓烘柟褰紝circle涓哄師鍨�
+			shape: {
+				type: String,
+				default: 'square'
+			},
+			// 閫変腑鐘舵�佷笅鐨勯鑹�
+			activeColor: {
+				type: String,
+				default: '#497bff'
+			},
+			// 缁勪欢鐨勬暣浣撳ぇ灏�
+			size: {
+				type: [String, Number],
+				default: 34
+			},
+			// 姣忎釜checkbox鍗爑-checkbox-group鐨勫搴�
+			width: {
+				type: String,
+				default: 'auto'
+			},
+			// 鏄惁姣忎釜checkbox閮芥崲琛�
+			wrap: { 
+				type: Boolean,
+				default: false
+			},
+			// 鍥炬爣鐨勫ぇ灏忥紝鍗曚綅rpx
+			iconSize: {
+				type: [String, Number],
+				default: 20
+			},
+		},
+		data() {
+			return {
+			}
+		},
+		created() {
+			// 濡傛灉灏哻hildren瀹氫箟鍦╠ata涓紝鍦ㄥ井淇″皬绋嬪簭浼氶�犳垚寰幆寮曠敤鑰屾姤閿�
+			this.children = [];
+		},
+		methods: {
+			emitEvent() {
+				let values = [];
+				this.children.map(val => {
+					if(val.value) values.push(val.name);
+				})
+				this.$emit('change', values);
+				// 鍙戝嚭浜嬩欢锛岀敤浜庡湪琛ㄥ崟缁勪欢涓祵鍏heckbox鐨勬儏鍐碉紝杩涜楠岃瘉
+				// 鐢变簬澶存潯灏忕▼搴忔墽琛岃繜閽濓紝鏁呴渶瑕佺敤鍑犲崄姣鐨勫欢鏃�
+				setTimeout(() => {
+					// 灏嗗綋鍓嶇殑鍊煎彂閫佸埌 u-form-item 杩涜鏍¢獙
+					this.dispatch('u-form-item', 'on-form-change', values);
+				}, 60)
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import "../../libs/css/style.components.scss";
+
+	.u-checkbox-group {
+		/* #ifndef MP || APP-NVUE */
+		display: inline-flex;
+		flex-wrap: wrap;
+		/* #endif */
+	}
+</style>

--
Gitblit v1.9.3