v1.0
This commit is contained in:
5
uni_modules/uv-line/changelog.md
Normal file
5
uni_modules/uv-line/changelog.md
Normal file
@ -0,0 +1,5 @@
|
||||
## 1.0.1(2023-05-16)
|
||||
1. 优化组件依赖,修改后无需全局引入,组件导入即可使用
|
||||
2. 优化部分功能
|
||||
## 1.0.0(2023-05-10)
|
||||
1. 新增线条组件
|
34
uni_modules/uv-line/components/uv-line/props.js
Normal file
34
uni_modules/uv-line/components/uv-line/props.js
Normal file
@ -0,0 +1,34 @@
|
||||
export default {
|
||||
props: {
|
||||
color: {
|
||||
type: String,
|
||||
default: '#d6d7d9'
|
||||
},
|
||||
// 长度,竖向时表现为高度,横向时表现为长度,可以为百分比,带px单位的值等
|
||||
length: {
|
||||
type: [String, Number],
|
||||
default: '100%'
|
||||
},
|
||||
// 线条方向,col-竖向,row-横向
|
||||
direction: {
|
||||
type: String,
|
||||
default: 'row'
|
||||
},
|
||||
// 是否显示细边框
|
||||
hairline: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 线条与上下左右元素的间距,字符串形式,如"30px"、"20px 30px"
|
||||
margin: {
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
},
|
||||
// 是否虚线,true-虚线,false-实线
|
||||
dashed: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
...uni.$uv?.props?.line
|
||||
}
|
||||
}
|
60
uni_modules/uv-line/components/uv-line/uv-line.vue
Normal file
60
uni_modules/uv-line/components/uv-line/uv-line.vue
Normal file
@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<view
|
||||
class="uv-line"
|
||||
:style="[lineStyle]"
|
||||
>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
|
||||
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
|
||||
import props from './props.js';
|
||||
/**
|
||||
* line 线条
|
||||
* @description 此组件一般用于显示一根线条,用于分隔内容块,有横向和竖向两种模式,且能设置0.5px线条,使用也很简单
|
||||
* @tutorial https://www.uvui.cn/components/line.html
|
||||
* @property {String} color 线条的颜色 ( 默认 '#d6d7d9' )
|
||||
* @property {String | Number} length 长度,竖向时表现为高度,横向时表现为长度,可以为百分比,带px单位的值等 ( 默认 '100%' )
|
||||
* @property {String} direction 线条的方向,row-横向,col-竖向 (默认 'row' )
|
||||
* @property {Boolean} hairline 是否显示细线条 (默认 true )
|
||||
* @property {String | Number} margin 线条与上下左右元素的间距,字符串形式,如"30px" (默认 0 )
|
||||
* @property {Boolean} dashed 是否虚线,true-虚线,false-实线 (默认 false )
|
||||
* @property {Object} customStyle 定义需要用到的外部样式
|
||||
* @example <uv-line color="red"></uv-line>
|
||||
*/
|
||||
export default {
|
||||
name: 'uv-line',
|
||||
mixins: [mpMixin, 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 = this.$uv.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 = this.$uv.addUnit(this.length)
|
||||
if (this.hairline) style.transform = 'scaleX(0.5)'
|
||||
}
|
||||
style.borderColor = this.color
|
||||
return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle))
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.uv-line {
|
||||
/* #ifndef APP-NVUE */
|
||||
vertical-align: middle;
|
||||
/* #endif */
|
||||
}
|
||||
</style>
|
87
uni_modules/uv-line/package.json
Normal file
87
uni_modules/uv-line/package.json
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"id": "uv-line",
|
||||
"displayName": "uv-line 线条 全面兼容小程序、nvue、vue2、vue3等多端",
|
||||
"version": "1.0.1",
|
||||
"description": "uv-line 此组件一般用于显示一根线条,用于分隔内容块,有横向和竖向两种模式,且能设置0.5px线条,使用也很简单。",
|
||||
"keywords": [
|
||||
"uv-line",
|
||||
"uvui",
|
||||
"uv-ui",
|
||||
"line",
|
||||
"线条"
|
||||
],
|
||||
"repository": "",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.1.0"
|
||||
},
|
||||
"dcloudext": {
|
||||
"type": "component-vue",
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "插件不采集任何数据",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": ""
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
"uv-ui-tools"
|
||||
],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
},
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y",
|
||||
"钉钉": "u",
|
||||
"快手": "u",
|
||||
"飞书": "u",
|
||||
"京东": "u"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
uni_modules/uv-line/readme.md
Normal file
11
uni_modules/uv-line/readme.md
Normal file
@ -0,0 +1,11 @@
|
||||
## Line 线条
|
||||
|
||||
> **组件名:uv-line**
|
||||
|
||||
此组件一般用于显示一根线条,用于分隔内容块,有横向和竖向两种模式,且能设置0.5px线条,使用也很简单。
|
||||
|
||||
### <a href="https://www.uvui.cn/components/line.html" target="_blank">查看文档</a>
|
||||
|
||||
### [完整示例项目下载 | 关注更多组件](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
||||
|
||||
#### 如使用过程中有任何问题,或者您对uv-ui有一些好的建议,欢迎加入 uv-ui 交流群:<a href="https://ext.dcloud.net.cn/plugin?id=12287" target="_blank">uv-ui</a>、<a href="https://www.uvui.cn/components/addQQGroup.html" target="_blank">官方QQ群</a>
|
Reference in New Issue
Block a user