From 1ef56b68318629e24f8e42406822059262d392b9 Mon Sep 17 00:00:00 2001
From: coder77 <2293444075@qq.com>
Date: Thu, 10 Apr 2025 11:03:25 +0800
Subject: [PATCH] Merge branch 'master_dev' of ssh://dev.zhiheiot.com:29418/mob-components into master_dev

---
 weappNative/chooseAvatar/weappChooseAvatar.js |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/weappNative/chooseAvatar/weappChooseAvatar.js b/weappNative/chooseAvatar/weappChooseAvatar.js
new file mode 100644
index 0000000..2071405
--- /dev/null
+++ b/weappNative/chooseAvatar/weappChooseAvatar.js
@@ -0,0 +1,46 @@
+/**
+ * 微信小程序原生头像选择组件
+ * 用于在小程序环境中调用原生的头像选择功能
+ * @author Tevin
+ * @tutorial
+ *  第一步:注册为 Taro 元素组件
+ *      打开 Taro 页面的 config.js 配置文件,在 usingComponents 中注册为元素组件
+ *      export default {
+ *          usingComponents: {
+ *              'weapp-choose-avatar': '@components/weappNative/chooseAvatar/weappChooseAvatar',
+ *          }
+ *      }
+ *  第二步:在页面中使用元素组件(直接当元素使用)
+ *      <weapp-choose-avatar @chooseAvatar="evt=>onChooseAvatar(evt)">
+ *          <button>选择头像</button>
+ *      </weapp-choose-avatar>
+ *
+ * @notice
+ *  1. 样式完全由内容决定,组件内部所有样式已清空
+ *  2. 绑定事件需要用“@”,返回参数为头像地址
+ */
+Component({
+    behaviors: [],
+    options: {
+        styleIsolation: 'apply-shared',
+    },
+    // 相当于 props
+    properties: {
+        // 禁用状态
+        disabled: {
+            type: Boolean,
+            value: false,
+        },
+        // 按钮文本
+        content: {
+            type: String,
+            value: '按钮',
+        },
+    },
+    data: {},
+    methods: {
+        handleChooseAvatar(evt) {
+            this.triggerEvent('chooseAvatar', evt.detail);
+        },
+    },
+});

--
Gitblit v1.9.1