From 16213c0f85aa3ac8317797bf4a05fd12940e16d3 Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期三, 05 三月 2025 17:29:42 +0800 Subject: [PATCH] - --- src/uni_modules/uview-plus/components/u-toolbar/u-toolbar.vue | 56 ++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/uni_modules/uview-plus/components/u-toolbar/u-toolbar.vue b/src/uni_modules/uview-plus/components/u-toolbar/u-toolbar.vue index 905345d..68e9f36 100644 --- a/src/uni_modules/uview-plus/components/u-toolbar/u-toolbar.vue +++ b/src/uni_modules/uview-plus/components/u-toolbar/u-toolbar.vue @@ -5,32 +5,45 @@ v-if="show" > <view - class="u-toolbar__cancel__wrapper" - hover-class="u-hover-class" + class="u-toolbar__left" > - <text - class="u-toolbar__wrapper__cancel" - @tap="cancel" - :style="{ - color: cancelColor - }" - >{{ cancelText }}</text> + <view + class="u-toolbar__cancel__wrapper" + hover-class="u-hover-class" + > + <text + class="u-toolbar__wrapper__cancel" + @tap="cancel" + :style="{ + color: cancelColor + }" + >{{ cancelText }}</text> + </view> </view> <text class="u-toolbar__title u-line-1" v-if="title" >{{ title }}</text> <view - class="u-toolbar__confirm__wrapper" - hover-class="u-hover-class" + class="u-toolbar__right" > - <text - class="u-toolbar__wrapper__confirm" - @tap="confirm" - :style="{ - color: confirmColor - }" - >{{ confirmText }}</text> + <view + v-if="!rightSlot" + class="u-toolbar__confirm__wrapper" + hover-class="u-hover-class" + > + <text + class="u-toolbar__wrapper__confirm" + @tap="confirm" + :style="{ + color: confirmColor + }" + >{{ confirmText }}</text> + </view> + <template v-else> + <slot name="right"> + </slot> + </template> </view> </view> </template> @@ -56,6 +69,9 @@ name: 'u-toolbar', mixins: [mpMixin, mixin, props], emits: ["confirm", "cancel"], + created() { + // console.log(this.$slots) + }, methods: { // 鐐瑰嚮鍙栨秷鎸夐挳 cancel() { @@ -95,6 +111,10 @@ } &__wrapper { + &__left, + &__right { + @include flex; + } &__confirm { color: $u-primary; font-size: 15px; -- Gitblit v1.9.1