Initial commit

This commit is contained in:
yuantao
2025-09-29 14:05:25 +08:00
commit 6f0bb2f949
579 changed files with 99061 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
/*
* @Author : LQ
* @Description :
* @version : 1.0
* @Date : 2021-08-20 16:44:21
* @LastAuthor : LQ
* @lastTime : 2021-08-20 17:17:13
* @FilePath : /u-view2.0/uview-ui/libs/config/props/noticeBar.js
*/
export default {
// noticeBar
noticeBar: {
text: [],
direction: 'row',
step: false,
icon: 'volume',
mode: '',
color: '#f9ae3d',
bgColor: '#fdf6ec',
speed: 80,
fontSize: 14,
duration: 2000,
disableTouch: true,
url: '',
linkType: 'navigateTo',
justifyContent: 'flex-start'
}
}

View File

@@ -0,0 +1,76 @@
import { defineMixin } from '../../libs/vue'
import defProps from '../../libs/config/props.js'
export const props = defineMixin({
props: {
// 显示的内容,数组
text: {
type: [Array, String],
default: () => defProps.noticeBar.text
},
// 通告滚动模式row-横向滚动column-竖向滚动
direction: {
type: String,
default: () => defProps.noticeBar.direction
},
// direction = row时是否使用步进形式滚动
step: {
type: Boolean,
default: () => defProps.noticeBar.step
},
// 是否显示左侧的音量图标
icon: {
type: String,
default: () => defProps.noticeBar.icon
},
// 通告模式link-显示右箭头closable-显示右侧关闭图标
mode: {
type: String,
default: () => defProps.noticeBar.mode
},
// 文字颜色,各图标也会使用文字颜色
color: {
type: String,
default: () => defProps.noticeBar.color
},
// 背景颜色
bgColor: {
type: String,
default: () => defProps.noticeBar.bgColor
},
// 水平滚动时的滚动速度即每秒滚动多少px(px),这有利于控制文字无论多少时,都能有一个恒定的速度
speed: {
type: [String, Number],
default: () => defProps.noticeBar.speed
},
// 字体大小
fontSize: {
type: [String, Number],
default: () => defProps.noticeBar.fontSize
},
// 滚动一个周期的时间长单位ms
duration: {
type: [String, Number],
default: () => defProps.noticeBar.duration
},
// 是否禁止用手滑动切换
// 目前HX2.6.11只支持App 2.5.5+、H5 2.5.5+、支付宝小程序、字节跳动小程序
disableTouch: {
type: Boolean,
default: () => defProps.noticeBar.disableTouch
},
// 跳转的页面路径
url: {
type: String,
default: () => defProps.noticeBar.url
},
// 页面跳转的类型
linkType: {
type: String,
default: () => defProps.noticeBar.linkType
},
justifyContent: {
type: String,
default: () => defProps.noticeBar.justifyContent
},
}
})

View File

@@ -0,0 +1,106 @@
<template>
<view
class="u-notice-bar"
v-if="show"
:style="[{
backgroundColor: bgColor
}, 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"
:justifyContent="justifyContent"
@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';
import { mpMixin } from '../../libs/mixin/mpMixin';
import { mixin } from '../../libs/mixin/mixin';
import { addStyle } from '../../libs/function/index';
/**
* noticeBar 滚动通知
* @description 该组件用于滚动通告场景,有多种模式可供选择
* @tutorial https://ijry.github.io/uview-plus/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: [mpMixin, mixin,props],
data() {
return {
show: true
}
},
emits: ["click", "close"],
methods: {
addStyle,
// 点击通告栏
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>