优化组件/更新
This commit is contained in:
12
uni_modules/uni-test/components/uni-section/config.json
Normal file
12
uni_modules/uni-test/components/uni-section/config.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "99999",
|
||||
"name": "Section",
|
||||
"desc": "标题栏",
|
||||
"edition": "0.0.1",
|
||||
"url": "section",
|
||||
"type": "布局组件",
|
||||
"path": "https://ext.dcloud.net.cn/plugin?id=",
|
||||
"hidden": true,
|
||||
"test":true,
|
||||
"update_log": []
|
||||
}
|
||||
30
uni_modules/uni-test/components/uni-section/readme.md
Normal file
30
uni_modules/uni-test/components/uni-section/readme.md
Normal file
@@ -0,0 +1,30 @@
|
||||
### Section 标题栏
|
||||
|
||||
标题栏,用于显示标题,组件名:``uni-section``,代码块: uSection。
|
||||
|
||||
### 使用方式
|
||||
|
||||
在 ``script`` 中引用组件
|
||||
|
||||
```javascript
|
||||
import uniSection from "@/components/uni-section/uni-section.vue"
|
||||
export default {
|
||||
components: {uniSection}
|
||||
}
|
||||
```
|
||||
|
||||
在 ``template`` 中使用组件
|
||||
|
||||
```html
|
||||
<uni-section title="只有主标题"></uni-section>
|
||||
<uni-section title="竖线装饰" sub-title="副标题" type="line"></uni-section>
|
||||
<uni-section title="圆形装饰" sub-title="副标题" type="circle"></uni-section>
|
||||
```
|
||||
|
||||
### 属性说明
|
||||
|
||||
|属性名 |类型 |默认值 |说明 |
|
||||
|--- |---- |--- |--- |
|
||||
|type |String |- |标题装饰类型 ,可选值:line(竖线)、circle(圆形)|
|
||||
|title |String |- |主标题 |
|
||||
|sub-title |String |- |副标题 |
|
||||
136
uni_modules/uni-test/components/uni-section/uni-section.vue
Normal file
136
uni_modules/uni-test/components/uni-section/uni-section.vue
Normal file
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<view class="uni-section" nvue>
|
||||
<view v-if="type" class="uni-section__head">
|
||||
<view :class="type" class="uni-section__head-tag" />
|
||||
</view>
|
||||
<view class="uni-section__content">
|
||||
<text :class="{'distraction':!subTitle}" class="uni-section__content-title">{{ title }}</text>
|
||||
<text v-if="subTitle" class="uni-section__content-sub">{{ subTitle }}</text>
|
||||
</view>
|
||||
<slot />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
/**
|
||||
* Section 标题栏
|
||||
* @description 标题栏
|
||||
* @property {String} type = [line|circle] 标题装饰类型
|
||||
* @value line 竖线
|
||||
* @value circle 圆形
|
||||
* @property {String} title 主标题
|
||||
* @property {String} subTitle 副标题
|
||||
*/
|
||||
|
||||
export default {
|
||||
name: 'UniSection',
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
subTitle: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
watch: {
|
||||
title(newVal) {
|
||||
if (uni.report && newVal !== '') {
|
||||
uni.report('title', newVal)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
this.$emit('click')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.uni-section {
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
margin-top: 10px;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding: 0 10px;
|
||||
height: 50px;
|
||||
background-color: $uni-bg-color-grey;
|
||||
/* #ifdef APP-NVUE */
|
||||
// border-bottom-color: $uni-border-color;
|
||||
// border-bottom-style: solid;
|
||||
// border-bottom-width: 0.5px;
|
||||
/* #endif */
|
||||
font-weight: normal;
|
||||
}
|
||||
/* #ifndef APP-NVUE */
|
||||
// .uni-section:after {
|
||||
// position: absolute;
|
||||
// bottom: 0;
|
||||
// right: 0;
|
||||
// left: 0;
|
||||
// height: 1px;
|
||||
// content: '';
|
||||
// -webkit-transform: scaleY(.5);
|
||||
// transform: scaleY(.5);
|
||||
// background-color: $uni-border-color;
|
||||
// }
|
||||
/* #endif */
|
||||
|
||||
.uni-section__head {
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.line {
|
||||
height: 15px;
|
||||
background-color: $uni-text-color-disable;
|
||||
border-radius: 5px;
|
||||
width: 3px;
|
||||
}
|
||||
|
||||
.circle {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-top-right-radius: 50px;
|
||||
border-top-left-radius: 50px;
|
||||
border-bottom-left-radius: 50px;
|
||||
border-bottom-right-radius: 50px;
|
||||
background-color: $uni-text-color-disable;
|
||||
}
|
||||
|
||||
.uni-section__content {
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
color: $uni-text-color;
|
||||
}
|
||||
|
||||
.uni-section__content-title {
|
||||
font-size: $uni-font-size-base;
|
||||
color: $uni-text-color;
|
||||
}
|
||||
|
||||
.distraction {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.uni-section__content-sub {
|
||||
font-size: $uni-font-size-sm;
|
||||
color: $uni-text-color-grey;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user