From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- uview-ui/components/u-line-progress/u-line-progress.vue | 147 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 147 insertions(+), 0 deletions(-) diff --git a/uview-ui/components/u-line-progress/u-line-progress.vue b/uview-ui/components/u-line-progress/u-line-progress.vue new file mode 100644 index 0000000..77e2da2 --- /dev/null +++ b/uview-ui/components/u-line-progress/u-line-progress.vue @@ -0,0 +1,147 @@ +<template> + <view class="u-progress" :style="{ + borderRadius: round ? '100rpx' : 0, + height: height + 'rpx', + backgroundColor: inactiveColor + }"> + <view :class="[ + type ? `u-type-${type}-bg` : '', + striped ? 'u-striped' : '', + striped && stripedActive ? 'u-striped-active' : '' + ]" class="u-active" :style="[progressStyle]"> + <slot v-if="$slots.default || $slots.$default" /> + <block v-else-if="showPercent"> + {{percent + '%'}} + </block> + </view> + </view> +</template> + +<script> + /** + * lineProgress 绾垮瀷杩涘害鏉� + * @description 灞曠ず鎿嶄綔鎴栦换鍔$殑褰撳墠杩涘害锛屾瘮濡備笂浼犳枃浠讹紝鏄竴涓嚎褰㈢殑杩涘害鏉°�� + * @tutorial https://www.uviewui.com/components/lineProgress.html + * @property {String Number} percent 杩涘害鏉$櫨鍒嗘瘮鍊硷紝涓烘暟鍊肩被鍨嬶紝0-100 + * @property {Boolean} round 杩涘害鏉′袱绔槸鍚︿负鍗婂渾锛堥粯璁rue锛� + * @property {String} type 濡傝缃紝active-color鍊煎皢浼氬け鏁� + * @property {String} active-color 杩涘害鏉℃縺娲婚儴鍒嗙殑棰滆壊锛堥粯璁�#19be6b锛� + * @property {String} inactive-color 杩涘害鏉$殑搴曡壊锛堥粯璁�#ececec锛� + * @property {Boolean} show-percent 鏄惁鍦ㄨ繘搴︽潯鍐呴儴鏄剧ず褰撳墠鐨勭櫨鍒嗘瘮鍊兼暟鍊硷紙榛樿true锛� + * @property {String Number} height 杩涘害鏉$殑楂樺害锛屽崟浣峳px锛堥粯璁�28锛� + * @property {Boolean} striped 鏄惁鏄剧ず杩涘害鏉℃縺娲婚儴鍒嗙殑鏉$汗锛堥粯璁alse锛� + * @property {Boolean} striped-active 鏉$汗鏄惁鍏锋湁鍔ㄦ�佹晥鏋滐紙榛樿false锛� + * @example <u-line-progress :percent="70" :show-percent="true"></u-line-progress> + */ + export default { + name: "u-line-progress", + props: { + // 涓ょ鏄惁鏄剧ず鍗婂渾褰� + round: { + type: Boolean, + default: true + }, + // 涓婚棰滆壊 + type: { + type: String, + default: '' + }, + // 婵�娲婚儴鍒嗙殑棰滆壊 + activeColor: { + type: String, + default: '#19be6b' + }, + inactiveColor: { + type: String, + default: '#ececec' + }, + // 杩涘害鐧惧垎姣旓紝鏁板�� + percent: { + type: Number, + default: 0 + }, + // 鏄惁鍦ㄨ繘搴︽潯鍐呴儴鏄剧ず鐧惧垎姣旂殑鍊� + showPercent: { + type: Boolean, + default: true + }, + // 杩涘害鏉$殑楂樺害锛屽崟浣峳px + height: { + type: [Number, String], + default: 28 + }, + // 鏄惁鏄剧ず鏉$汗 + striped: { + type: Boolean, + default: false + }, + // 鏉$汗鏄惁鏄剧ず娲诲姩鐘舵�� + stripedActive: { + type: Boolean, + default: false + } + }, + data() { + return { + + } + }, + computed: { + progressStyle() { + let style = {}; + style.width = this.percent + '%'; + if(this.activeColor) style.backgroundColor = this.activeColor; + return style; + } + }, + methods: { + + } + } +</script> + +<style lang="scss" scoped> + @import "../../libs/css/style.components.scss"; + + .u-progress { + overflow: hidden; + height: 15px; + /* #ifndef APP-NVUE */ + display: inline-flex; + /* #endif */ + align-items: center; + width: 100%; + border-radius: 100rpx; + } + + .u-active { + width: 0; + height: 100%; + align-items: center; + @include vue-flex; + justify-items: flex-end; + justify-content: space-around; + font-size: 20rpx; + color: #ffffff; + transition: all 0.4s ease; + } + + .u-striped { + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-size: 39px 39px; + } + + .u-striped-active { + animation: progress-stripes 2s linear infinite; + } + + @keyframes progress-stripes { + 0% { + background-position: 0 0; + } + + 100% { + background-position: 39px 0; + } + } +</style> -- Gitblit v1.9.3