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 --- plugins/baiduMap/CBaiduMap.weapp.vue | 4 +- weappNative/chooseAvatar/weappChooseAvatar.js | 46 +++++++++++++++++++++++ weappNative/chooseAvatar/weappChooseAvatar.wxml | 11 +++++ weappNative/chooseAvatar/weappChooseAvatar.json | 4 ++ plugins/baiduMap/cBaiduMap.scss | 13 ++++-- weappNative/chooseAvatar/weappChooseAvatar.wxss | 10 +++++ 6 files changed, 82 insertions(+), 6 deletions(-) diff --git a/plugins/baiduMap/CBaiduMap.weapp.vue b/plugins/baiduMap/CBaiduMap.weapp.vue index c6247f3..2491458 100644 --- a/plugins/baiduMap/CBaiduMap.weapp.vue +++ b/plugins/baiduMap/CBaiduMap.weapp.vue @@ -28,7 +28,7 @@ type="primary" size="small" :onClick="evt => handleChooseLocation(evt)" - >选择位置</AtButton> + >选择地点</AtButton> <AtButton type="primary" size="small" @@ -41,7 +41,7 @@ size="small" class="btn-info" :onClick="evt => handleSaveLocation(evt)" - >保存</AtButton> + >确认</AtButton> </view> </view> </view> diff --git a/plugins/baiduMap/cBaiduMap.scss b/plugins/baiduMap/cBaiduMap.scss index 0bd329f..49d5f70 100644 --- a/plugins/baiduMap/cBaiduMap.scss +++ b/plugins/baiduMap/cBaiduMap.scss @@ -27,27 +27,32 @@ .map-controls-top { display: flex; + width: 100%; justify-content: space-between; align-items: center; height: 100px; padding: 0 20px; + box-sizing: border-box; .at-button { - width: 45%; + width: calc(50% - 6px); height: 76px !important; line-height: 72px; font-size: 40px; + margin: 0; } } .map-controls-bottom { display: flex; - align-items: center; - height: 100px; + width: 100%; + height: 88px; padding: 0 20px; + box-sizing: border-box; .at-button { - width: 95%; + width: 100%; height: 76px !important; line-height: 72px; font-size: 40px; + margin: 0; } } } 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); + }, + }, +}); diff --git a/weappNative/chooseAvatar/weappChooseAvatar.json b/weappNative/chooseAvatar/weappChooseAvatar.json new file mode 100644 index 0000000..59a1db6 --- /dev/null +++ b/weappNative/chooseAvatar/weappChooseAvatar.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/weappNative/chooseAvatar/weappChooseAvatar.wxml b/weappNative/chooseAvatar/weappChooseAvatar.wxml new file mode 100644 index 0000000..84d82ae --- /dev/null +++ b/weappNative/chooseAvatar/weappChooseAvatar.wxml @@ -0,0 +1,11 @@ +<button + class="c-choose-avatar" + type="default" + plain="true" + size="mini" + disabled="{{ disabled }}" + open-type="chooseAvatar" + bindchooseavatar="{{ 'handleChooseAvatar' }}" +> + <slot></slot> +</button> diff --git a/weappNative/chooseAvatar/weappChooseAvatar.wxss b/weappNative/chooseAvatar/weappChooseAvatar.wxss new file mode 100644 index 0000000..4581835 --- /dev/null +++ b/weappNative/chooseAvatar/weappChooseAvatar.wxss @@ -0,0 +1,10 @@ +.c-choose-avatar { + width: auto; + height: auto; + padding-left: 0rpx !important; + padding-right: 0rpx !important; + margin: 0; + border-width: 0 !important; + border-color: transparent !important; + -webkit-tap-highlight-color: transparent !important; +} \ No newline at end of file -- Gitblit v1.9.1