From cd3a39aeabf0a336b4b53b16915848275c352c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Thu, 21 Nov 2024 09:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BD=AE=E6=92=AD?= =?UTF-8?q?=E6=96=B9=E5=90=91=E5=92=8C=E6=8C=87=E7=A4=BA=E5=99=A8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/css/page.css | 12 ++-- common/js/common/common.js | 32 ++++++++- components/diy/custom.vue | 132 +++++++++++++++++++++++++++++++---- components/diy/nav-group.vue | 31 +------- 4 files changed, 159 insertions(+), 48 deletions(-) diff --git a/common/css/page.css b/common/css/page.css index b8e9f6c3..b5b67cee 100644 --- a/common/css/page.css +++ b/common/css/page.css @@ -1374,22 +1374,22 @@ button[disabled].bg-grey { .indicator_up_down_location { position: absolute; z-index: 1; - padding-top: 10px; - padding-bottom: 10px; + padding-top: 20rpx; + padding-bottom: 20rpx; display: flex; flex-direction: column; } .indicator_up_down_location .dot-item { - margin: 0.3rem 0; + margin: 6rpx 0; } /* 指示器左右显示 */ .indicator_about_location { position: absolute; z-index: 1; - padding-right: 10px; - padding-left: 10px; + padding-right: 20rpx; + padding-left: 20rpx; display: flex; } .indicator_about_location .dot-item { - margin: 0 0.3rem; + margin: 0 6rpx; } \ No newline at end of file diff --git a/common/js/common/common.js b/common/js/common/common.js index e1d602f5..568c6730 100644 --- a/common/js/common/common.js +++ b/common/js/common/common.js @@ -14,7 +14,7 @@ export function is_obj_empty(obj) { } /** - * 处理指示器的显示问题 + * 指示器的样式 * * @param style_object 样式对象 * @returns 返回对应的值 @@ -44,6 +44,36 @@ export function get_indicator_style(style_object) { } return styles; } +/** + * 指示器的位置处理 + * + * @param style_object 样式对象 + * @returns 返回对应的值 + */ +export function get_indicator_location_style(style_object) { + const { indicator_new_location, indicator_location, indicator_bottom } = style_object; + let styles = ''; + if (['left', 'right'].includes(indicator_new_location)) { + if (indicator_location == 'flex-start') { + styles += `top: 0px;`; + } else if (indicator_location == 'center') { + styles += `top: 50%; transform: translateY(-50%);`; + } else { + styles += `bottom: 0px;`; + } + } else { + if (indicator_location == 'flex-start') { + styles += `left: 0px;`; + } else if (indicator_location == 'center') { + styles += `left: 50%; transform: translateX(-50%);`; + } else { + styles += `right: 0px;`; + } + } + // 如果有位置的处理,就使用指示器的位置处理,否则的话就用下边距处理 + styles += `${ !isEmpty(indicator_new_location) ? `${indicator_new_location}: ${ indicator_bottom }px;` : `bottom: ${ indicator_bottom }px;` }`; + return styles; +}; /** * 判断对象数组等是否为空。 diff --git a/components/diy/custom.vue b/components/diy/custom.vue index da9486fd..920944ca 100644 --- a/components/diy/custom.vue +++ b/components/diy/custom.vue @@ -1,22 +1,53 @@