From d8b41fff43a2cee6a8f714ffa807623b15803786 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Fri, 20 Oct 2023 15:21:35 +0800 Subject: [PATCH] fix:立行立改Uniapp小程序新建项目 --- uni_modules/uview-ui/components/u-notice-bar/u-notice-bar.vue | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 101 insertions(+), 0 deletions(-) diff --git a/uni_modules/uview-ui/components/u-notice-bar/u-notice-bar.vue b/uni_modules/uview-ui/components/u-notice-bar/u-notice-bar.vue new file mode 100644 index 0000000..a06eb39 --- /dev/null +++ b/uni_modules/uview-ui/components/u-notice-bar/u-notice-bar.vue @@ -0,0 +1,101 @@ +<template> + <view + class="u-notice-bar" + v-if="show" + :style="[{ + backgroundColor: bgColor + }, $u.addStyle(customStyle)]" + > + <template v-if="direction === 'column' || (direction === 'row' && step)"> + <u-column-notice + :color="color" + :bgColor="bgColor" + :text="text" + :mode="mode" + :step="step" + :icon="icon" + :disable-touch="disableTouch" + :fontSize="fontSize" + :duration="duration" + @close="close" + @click="click" + ></u-column-notice> + </template> + <template v-else> + <u-row-notice + :color="color" + :bgColor="bgColor" + :text="text" + :mode="mode" + :fontSize="fontSize" + :speed="speed" + :url="url" + :linkType="linkType" + :icon="icon" + @close="close" + @click="click" + ></u-row-notice> + </template> + </view> +</template> +<script> + import props from './props.js'; + + /** + * noticeBar ������������ + * @description ��������������������������������������������������������������� + * @tutorial https://www.uviewui.com/components/noticeBar.html + * @property {Array | String} text ������������������������ + * @property {String} direction ���������������������row-���������������column-������������ ( ������ 'row' ) + * @property {Boolean} step direction = row������������������������������������ ( ������ false ) + * @property {String} icon ��������������������������������� ( ������ 'volume' ) + * @property {String} mode ���������������link-������������������closable-������������������������ + * @property {String} color ������������������������������������������������ ( ������ '#f9ae3d' ) + * @property {String} bgColor ������������ ( ������ '#fdf6ec' ) + * @property {String | Number} speed ������������������������������������������������������px(px)��������������������������������������������������������������������������� ( ������ 80 ) + * @property {String | Number} fontSize ������������ ( ������ 14 ) + * @property {String | Number} duration ���������������������������������������ms ( ������ 2000 ) + * @property {Boolean} disableTouch ������������������������������ ������HX2.6.11������������App 2.5.5+���H5 2.5.5+������������������������������������������������������34��� ( ������ true ) + * @property {String} url ��������������������� + * @property {String} linkType ��������������������� ( ������ navigateTo ) + * @property {Object} customStyle ��������������������������������� + * + * @event {Function} click ������������������������ + * @event {Function} close ������������������������������ + * @example <u-notice-bar :more-icon="true" :list="list"></u-notice-bar> + */ + export default { + name: "u-notice-bar", + mixins: [uni.$u.mpMixin, uni.$u.mixin,props], + data() { + return { + show: true + } + }, + methods: { + // ��������������� + click(index) { + this.$emit('click', index) + if (this.url && this.linkType) { + // ���������������mixin���������������������url���linkType������������mixin���props��� + this.openPage() + } + }, + // ������������������ + close() { + this.show = false + this.$emit('close') + } + } + }; +</script> + +<style lang="scss" scoped> + @import "../../libs/css/components.scss"; + + .u-notice-bar { + overflow: hidden; + padding: 9px 12px; + flex: 1; + } +</style> -- Gitblit v1.8.0