From d1448cb0ef10f358bb7bddb4e1ec268515e0b787 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 15 七月 2025 11:46:57 +0800 Subject: [PATCH] 项目初始化 --- uni_modules/uview-ui/components/u-toolbar/u-toolbar.vue | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 102 insertions(+), 0 deletions(-) diff --git a/uni_modules/uview-ui/components/u-toolbar/u-toolbar.vue b/uni_modules/uview-ui/components/u-toolbar/u-toolbar.vue new file mode 100644 index 0000000..290b771 --- /dev/null +++ b/uni_modules/uview-ui/components/u-toolbar/u-toolbar.vue @@ -0,0 +1,102 @@ +<template> + <view + class="u-toolbar" + @touchmove.stop.prevent="noop" + v-if="show" + > + <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> + <text + class="u-toolbar__title u-line-1" + v-if="title" + >{{ title }}</text> + <view + class="u-toolbar__confirm__wrapper" + hover-class="u-hover-class" + > + <text + class="u-toolbar__wrapper__confirm" + @tap="confirm" + :style="{ + color: confirmColor + }" + >{{ confirmText }}</text> + </view> + </view> +</template> + +<script> + import props from './props.js'; + /** + * Toolbar 宸ュ叿鏉� + * @description + * @tutorial https://www.uviewui.com/components/toolbar.html + * @property {Boolean} show 鏄惁灞曠ず宸ュ叿鏉★紙榛樿 true 锛� + * @property {String} cancelText 鍙栨秷鎸夐挳鐨勬枃瀛楋紙榛樿 '鍙栨秷' 锛� + * @property {String} confirmText 纭鎸夐挳鐨勬枃瀛楋紙榛樿 '纭' 锛� + * @property {String} cancelColor 鍙栨秷鎸夐挳鐨勯鑹诧紙榛樿 '#909193' 锛� + * @property {String} confirmColor 纭鎸夐挳鐨勯鑹诧紙榛樿 '#3c9cff' 锛� + * @property {String} title 鏍囬鏂囧瓧 + * @event {Function} + * @example + */ + export default { + name: 'u-toolbar', + mixins: [uni.$u.mpMixin, uni.$u.mixin,props], + methods: { + // 鐐瑰嚮鍙栨秷鎸夐挳 + cancel() { + this.$emit('cancel') + }, + // 鐐瑰嚮纭畾鎸夐挳 + confirm() { + this.$emit('confirm') + } + }, + } +</script> + +<style lang="scss" scoped> + @import "../../libs/css/components.scss"; + + .u-toolbar { + height: 42px; + @include flex; + justify-content: space-between; + align-items: center; + + &__wrapper { + &__cancel { + color: $u-tips-color; + font-size: 15px; + padding: 0 15px; + } + } + + &__title { + color: $u-main-color; + padding: 0 60rpx; + font-size: 16px; + flex: 1; + text-align: center; + } + + &__wrapper { + &__confirm { + color: $u-primary; + font-size: 15px; + padding: 0 15px; + } + } + } +</style> -- Gitblit v1.9.3