-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f70eb47
commit 6d1160b
Showing
9 changed files
with
381 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## 1.1.1(2022-05-19) | ||
- 修改组件描述 | ||
## 1.1.0(2021-11-19) | ||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) | ||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-title](https://uniapp.dcloud.io/component/uniui/uni-title) | ||
## 1.0.2(2021-05-12) | ||
- 新增 示例地址 | ||
- 修复 示例项目缺少组件的Bug | ||
## 1.0.1(2021-02-05) | ||
- 调整为uni_modules目录规范 |
171 changes: 171 additions & 0 deletions
171
components/uni-title/components/uni-title/uni-title.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
<template> | ||
<view class="uni-title__box" :style="{'align-items':textAlign}"> | ||
<text class="uni-title__base" :class="['uni-'+type]" :style="{'color':color}">{{title}}</text> | ||
</view> | ||
</template> | ||
|
||
<script> | ||
/** | ||
* Title 标题 | ||
* @description 标题,通常用于记录页面标题,使用当前组件,uni-app 如果开启统计,将会自动统计页面标题 | ||
* @tutorial https://ext.dcloud.net.cn/plugin?id=1066 | ||
* @property {String} type = [h1|h2|h3|h4|h5] 标题类型 | ||
* @value h1 一级标题 | ||
* @value h2 二级标题 | ||
* @value h3 三级标题 | ||
* @value h4 四级标题 | ||
* @value h5 五级标题 | ||
* @property {String} title 标题内容 | ||
* @property {String} align = [left|center|right] 对齐方式 | ||
* @value left 做对齐 | ||
* @value center 居中对齐 | ||
* @value right 右对齐 | ||
* @property {String} color 字体颜色 | ||
* @property {Boolean} stat = [true|false] 是否开启统计功能呢,如不填写type值,默认为开启,填写 type 属性,默认为关闭 | ||
*/ | ||
export default { | ||
name:"UniTitle", | ||
props: { | ||
type: { | ||
type: String, | ||
default: '' | ||
}, | ||
title: { | ||
type: String, | ||
default: '' | ||
}, | ||
align: { | ||
type: String, | ||
default: 'left' | ||
}, | ||
color: { | ||
type: String, | ||
default: '#333333' | ||
}, | ||
stat: { | ||
type: [Boolean, String], | ||
default: '' | ||
} | ||
}, | ||
data() { | ||
return { | ||
}; | ||
}, | ||
computed: { | ||
textAlign() { | ||
let align = 'center'; | ||
switch (this.align) { | ||
case 'left': | ||
align = 'flex-start' | ||
break; | ||
case 'center': | ||
align = 'center' | ||
break; | ||
case 'right': | ||
align = 'flex-end' | ||
break; | ||
} | ||
return align | ||
} | ||
}, | ||
watch: { | ||
title(newVal) { | ||
if (this.isOpenStat()) { | ||
// 上报数据 | ||
if (uni.report) { | ||
uni.report('title', this.title) | ||
} | ||
} | ||
} | ||
}, | ||
mounted() { | ||
if (this.isOpenStat()) { | ||
// 上报数据 | ||
if (uni.report) { | ||
uni.report('title', this.title) | ||
} | ||
} | ||
}, | ||
methods: { | ||
isOpenStat() { | ||
if (this.stat === '') { | ||
this.isStat = false | ||
} | ||
let stat_type = (typeof(this.stat) === 'boolean' && this.stat) || (typeof(this.stat) === 'string' && this.stat !== | ||
'') | ||
if (this.type === "") { | ||
this.isStat = true | ||
if (this.stat.toString() === 'false') { | ||
this.isStat = false | ||
} | ||
} | ||
if (this.type !== '') { | ||
this.isStat = true | ||
if (stat_type) { | ||
this.isStat = true | ||
} else { | ||
this.isStat = false | ||
} | ||
} | ||
return this.isStat | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
/* .uni-title { | ||
} */ | ||
.uni-title__box { | ||
/* #ifndef APP-NVUE */ | ||
display: flex; | ||
/* #endif */ | ||
flex-direction: column; | ||
align-items: flex-start; | ||
justify-content: center; | ||
padding: 8px 0; | ||
flex: 1; | ||
} | ||
.uni-title__base { | ||
font-size: 15px; | ||
color: #333; | ||
font-weight: 500; | ||
} | ||
.uni-h1 { | ||
font-size: 20px; | ||
color: #333; | ||
font-weight: bold; | ||
} | ||
.uni-h2 { | ||
font-size: 18px; | ||
color: #333; | ||
font-weight: bold; | ||
} | ||
.uni-h3 { | ||
font-size: 16px; | ||
color: #333; | ||
font-weight: bold; | ||
/* font-weight: 400; */ | ||
} | ||
.uni-h4 { | ||
font-size: 14px; | ||
color: #333; | ||
font-weight: bold; | ||
/* font-weight: 300; */ | ||
} | ||
.uni-h5 { | ||
font-size: 12px; | ||
color: #333; | ||
font-weight: bold; | ||
/* font-weight: 200; */ | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"id": "uni-title", | ||
"displayName": "uni-title 章节标题", | ||
"version": "1.1.1", | ||
"description": "章节标题,通常用于记录页面标题,使用当前组件,uni-app 如果开启统计,将会自动统计页面标题", | ||
"keywords": [ | ||
"uni-ui", | ||
"uniui", | ||
"标题", | ||
"章节", | ||
"章节标题", | ||
"" | ||
], | ||
"repository": "https://github.com/dcloudio/uni-ui", | ||
"engines": { | ||
"HBuilderX": "" | ||
}, | ||
"directories": { | ||
"example": "../../temps/example_temps" | ||
}, | ||
"dcloudext": { | ||
"category": [ | ||
"前端组件", | ||
"通用组件" | ||
], | ||
"sale": { | ||
"regular": { | ||
"price": "0.00" | ||
}, | ||
"sourcecode": { | ||
"price": "0.00" | ||
} | ||
}, | ||
"contact": { | ||
"qq": "" | ||
}, | ||
"declaration": { | ||
"ads": "无", | ||
"data": "无", | ||
"permissions": "无" | ||
}, | ||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" | ||
}, | ||
"uni_modules": { | ||
"dependencies": ["uni-scss"], | ||
"encrypt": [], | ||
"platforms": { | ||
"cloud": { | ||
"tcb": "y", | ||
"aliyun": "y" | ||
}, | ||
"client": { | ||
"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" | ||
}, | ||
"Vue": { | ||
"vue2": "y", | ||
"vue3": "y" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
|
||
## Title 标题 | ||
> **组件名:uni-title** | ||
> 代码块: `uTitle` | ||
|
||
章节标题,通常用于记录页面标题,使用当前组件,uni-app 如果开启统计,将会自动统计页面标题 。 | ||
|
||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-title) | ||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 | ||
|
||
|
||
|
Oops, something went wrong.