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-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 閫氬憡婊氬姩妯″紡锛宺ow-妯悜婊氬姩锛宑olumn-绔栧悜婊氬姩 ( 榛樿 'row' ) + * @property {Boolean} step direction = row鏃讹紝鏄惁浣跨敤姝ヨ繘褰㈠紡婊氬姩 ( 榛樿 false ) + * @property {String} icon 鏄惁鏄剧ず宸︿晶鐨勯煶閲忓浘鏍� ( 榛樿 'volume' ) + * @property {String} mode 閫氬憡妯″紡锛宭ink-鏄剧ず鍙崇澶达紝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+銆丠5 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) { + // 姝ゆ柟娉曞啓鍦╩ixin涓紝鍙﹀璺宠浆鐨剈rl鍜宭inkType鍙傛暟涔熷湪mixin鐨刾rops涓� + 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.9.3