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-line/u-line.vue | 62 +++++++++++++++++++++++++++++++ 1 files changed, 62 insertions(+), 0 deletions(-) diff --git a/uni_modules/uview-ui/components/u-line/u-line.vue b/uni_modules/uview-ui/components/u-line/u-line.vue new file mode 100644 index 0000000..e0a6d92 --- /dev/null +++ b/uni_modules/uview-ui/components/u-line/u-line.vue @@ -0,0 +1,62 @@ +<template> + <view + class="u-line" + :style="[lineStyle]" + > + + </view> +</template> + +<script> + import props from './props.js'; + /** + * line 绾挎潯 + * @description 姝ょ粍浠朵竴鑸敤浜庢樉绀轰竴鏍圭嚎鏉★紝鐢ㄤ簬鍒嗛殧鍐呭鍧楋紝鏈夋í鍚戝拰绔栧悜涓ょ妯″紡锛屼笖鑳借缃�0.5px绾挎潯锛屼娇鐢ㄤ篃寰堢畝鍗� + * @tutorial https://www.uviewui.com/components/line.html + * @property {String} color 绾挎潯鐨勯鑹� ( 榛樿 '#d6d7d9' ) + * @property {String | Number} length 闀垮害锛岀珫鍚戞椂琛ㄧ幇涓洪珮搴︼紝妯悜鏃惰〃鐜颁负闀垮害锛屽彲浠ヤ负鐧惧垎姣旓紝甯x鍗曚綅鐨勫�肩瓑 ( 榛樿 '100%' ) + * @property {String} direction 绾挎潯鐨勬柟鍚戯紝row-妯悜锛宑ol-绔栧悜 (榛樿 'row' ) + * @property {Boolean} hairline 鏄惁鏄剧ず缁嗙嚎鏉� (榛樿 true ) + * @property {String | Number} margin 绾挎潯涓庝笂涓嬪乏鍙冲厓绱犵殑闂磋窛锛屽瓧绗︿覆褰㈠紡锛屽"30px" (榛樿 0 ) + * @property {Boolean} dashed 鏄惁铏氱嚎锛宼rue-铏氱嚎锛宖alse-瀹炵嚎 (榛樿 false ) + * @property {Object} customStyle 瀹氫箟闇�瑕佺敤鍒扮殑澶栭儴鏍峰紡 + * @example <u-line color="red"></u-line> + */ + export default { + name: 'u-line', + mixins: [uni.$u.mpMixin, uni.$u.mixin,props], + computed: { + lineStyle() { + const style = {} + style.margin = this.margin + // 濡傛灉鏄按骞崇嚎鏉★紝杈规楂樺害涓�1px锛屽啀閫氳繃transform缂╁皬涓�鍗婏紝灏辨槸0.5px浜� + if (this.direction === 'row') { + // 姝ゅ閲囩敤鍏煎鍒嗗紑鍐欙紝鍏煎nvue鐨勫啓娉� + style.borderBottomWidth = '1px' + style.borderBottomStyle = this.dashed ? 'dashed' : 'solid' + style.width = uni.$u.addUnit(this.length) + if (this.hairline) style.transform = 'scaleY(0.5)' + } else { + // 濡傛灉鏄珫鍚戠嚎鏉★紝杈规瀹藉害涓�1px锛屽啀閫氳繃transform缂╁皬涓�鍗婏紝灏辨槸0.5px浜� + style.borderLeftWidth = '1px' + style.borderLeftStyle = this.dashed ? 'dashed' : 'solid' + style.height = uni.$u.addUnit(this.length) + if (this.hairline) style.transform = 'scaleX(0.5)' + } + + style.borderColor = this.color + return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle)) + } + } + } +</script> + +<style lang="scss" scoped> + @import "../../libs/css/components.scss"; + + .u-line { + /* #ifndef APP-NVUE */ + vertical-align: middle; + /* #endif */ + } +</style> -- Gitblit v1.9.3