Skip to content

Commit

Permalink
feat: 自动文档更新完善
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhenfei committed Nov 13, 2020
1 parent b9a1137 commit b6f7481
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 44 deletions.
82 changes: 51 additions & 31 deletions components/pi-button/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,156 +49,176 @@ const { button } = getConfig()
export default {
name: 'Button',
props: {
/**
* uniapp button 官方属性定义
* ---------------------------------------------------------------------------------------------
*/
// 按钮尺寸,default,large medium small tiny mini(默认值:'default')
// ------------------------- uniapp button 官方属性定义 Start -------------------------
// 按钮尺寸,default,large medium small tiny mini
size: {
type: String,
// default
default: button.size,
validator: function(value) {
return ['default', 'large', 'medium', 'small', 'tiny', 'mini'].includes(value)
}
},
// 按钮的预置样式,default,primary,warn,secondary line(默认值:'default')
// 按钮的预置样式,default,primary,warn,secondary line
type: {
type: String,
// default
default: button.type,
validator: function(value) {
return ['default', 'primary', 'warn', 'secondary', 'line'].includes(value)
}
},
// 按钮是否镂空(默认值:false)
// 按钮是否镂空
plain: {
type: Boolean,
// false
default: button.plain
},
// 是否禁止状态(默认值:false)
// 是否禁止状态
disabled: {
type: Boolean,
// false
default: button.disabled
},
// 是否加载中(默认值:false)
// 是否加载中
loading: {
type: Boolean,
// false
default: button.loading
},
// 取值为submit(提交表单),reset(重置表单)(默认值:'')
// 取值为submit(提交表单),reset(重置表单)
formType: {
type: String,
// ''
default: button.formType
},
// 开放能力,具体请看uniapp稳定关于button组件部分说明(默认值:'')
// 开放能力,具体请看uniapp稳定关于button组件部分说明
openType: {
type: String,
// ''
default: button.openType
},
// 指定按钮按下去的样式类。当 hover-class="none" 时,没有点击态效果,默认(button-hover)
// 指定按钮按下去的样式类。当 hover-class="none" 时,没有点击态效果
hoverClass: {
type: String,
// 'button-hover'
default: button.hoverClass
},
// 按住后多久出现点击态,单位毫秒(默认值:20)
// 按住后多久出现点击态,单位毫秒
hoverStartTime: {
type: Number,
// 20
default: button.hoverStartTime
},
// 手指松开后点击态保留时间,单位毫秒(默认值:70)
// 手指松开后点击态保留时间,单位毫秒
hoverStayTime: {
type: Number,
// 70
default: button.hoverStayTime
},
// 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效(默认值:'')
// 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
appParameter: {
type: String,
// ''
default: button.appParameter
},
// 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效(默认值:false)
// 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效
hoverStopPropagation: {
type: Boolean,
// false
default: button.hoverStopPropagation
},
// 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效(默认值:'en')
// 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效
lang: {
type: String,
// 'en'
default: button.lang
},
// 会话来源,open-type="contact"时有效。只微信小程序有效(默认值:'')
// 会话来源,open-type="contact"时有效。只微信小程序有效
sessionFrom: {
type: String,
// ''
default: button.sessionFrom
},
// 会话内消息卡片标题,open-type="contact"时有效(默认值:'')
// 会话内消息卡片标题,open-type="contact"时有效
// 默认当前标题,只微信小程序有效
sendMessageTitle: {
type: String,
// ''
default: button.sendMessageTitle
},
// 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效(默认值:'')
// 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
// 默认当前分享路径,只微信小程序有效
sendMessagePath: {
type: String,
// ''
default: button.sendMessagePath
},
// 会话内消息卡片图片,open-type="contact"时有效(默认值:'')
// 会话内消息卡片图片,open-type="contact"时有效
// 默认当前页面截图,只微信小程序有效
sendMessageImg: {
type: String,
// ''
default: button.sendMessageImg
},
// 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,
// 用户点击后可以快速发送小程序消息,open-type="contact"时有效(默认值:'false')
// 用户点击后可以快速发送小程序消息,open-type="contact"时有效
showMessageCard: {
type: Boolean,
// false
default: button.showMessageCard
},
/**
* 自定义属性扩展
* ---------------------------------------------------------------------------------------------
*/
// 自定义样式,对象形式(默认值:{})
// ------------------------- uniapp button 官方属性定义 End ---------------------------
// 自定义样式,对象形式
customStyle: {
type: Object,
// {}
default() {
return button.customStyle
}
},
// 自定义样式类,字符串形式('')
// 自定义样式类,字符串形式
customClass: {
type: String,
// {}
default() {
return button.customClass
}
},
// 按钮宽度,不设置默认自动撑开,如果需要占满一行,填写’100%‘
width: {
type: [String, Number],
// ''
default: button.width
},
// 自定义颜色按钮(type为default,可自定义设置)
color: {
type: String,
default: ''
// ''
default: button.color
},
// 自定义背景色按钮(type为default,可自定义设置)
bgColor: {
type: String,
default: ''
// ''
default: button.bgColor
},
// 按钮是否椭圆(默认值:false)
// 按钮是否椭圆
round: {
type: Boolean,
// false
default: button.round
},
// 是否开启水波纹效果(默认值:true)
ripple: {
type: Boolean,
// true
default: button.ripple
},
// 水波纹的背景颜色(默认值:'')
rippleBgColor: {
type: String,
// ''
default: button.rippleBgColor
}
},
Expand Down
12 changes: 1 addition & 11 deletions components/pi-calendar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,6 @@ export default {
}
},
computed: {
// ! 使用计算属性依赖变化的特征,watch options
// ! 因为使用对象,在H5端watch的时候,就算没有发生改变,也会触发,这里直接监听toString后的值
options() {
const watchs = ['defaultValue', 'type', 'minYear', 'maxYear', 'minDate', 'maxDate']
const options = watchs
.filter(d => this[d])
.map(d => this[d].toString())
.join('-')
return options
},
getTitlePadding() {
return this.$pi.common.addUnit(this.titlePadding)
},
Expand Down Expand Up @@ -440,7 +430,7 @@ export default {
}
},
watch: {
options(val) {
value(val) {
this.init()
}
},
Expand Down
2 changes: 1 addition & 1 deletion components/pi-grid-item/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { getConfig } from '../../config'
const TAG = 'PiGridItem'
const { gridItem } = getConfig()
const extendPiGrid = childInit('PiGrid')
const extendPiGrid = childInit('Grid')
export default {
name: 'GridItem',
Expand Down
11 changes: 11 additions & 0 deletions components/pi-select/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ export default {
type: Boolean,
default: select.isMulti
},
// 单选模式下,是否可取消选中
singleCancel: {
type: Boolean,
// true
default: select.singleCancel
},
// 是否显示title(默认:true)
showTitle: {
type: Boolean,
Expand Down Expand Up @@ -323,6 +329,11 @@ export default {
handleSelectItem(item) {
if (!this.isMulti) {
// 单选
if (!this.singleCancel) {
this.selected = item
return
}
// 如果单选允许取消,需要判断是否点击了同一个选项
const isSame =
!this.$pi.lang.isEmpty(this.selected) &&
this.selected[this.keyField] === item[this.keyField]
Expand Down
2 changes: 2 additions & 0 deletions config/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default {
sendMessagePath: '', // 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效(默认值:'')
sendMessageImg: '', // 会话内消息卡片图片,open-type="contact"时有效(默认值:'')
showMessageCard: false, // 用户点击后可以快速发送小程序消息,open-type="contact"时有效(默认值:'false')
color: '', // 自定义颜色按钮(type为default,可自定义设置)
bgColor: '', // 自定义背景色按钮(type为default,可自定义设置)
round: false, // 按钮是否椭圆(默认值:false)
ripple: true, // 是否开启水波纹效果(默认值:true)
rippleBgColor: '' // 水波纹的背景颜色(默认值:'')
Expand Down
1 change: 1 addition & 0 deletions config/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default {
displayField: 'text', // 选项显示字段,默认为text
defaultValue: null, // 默认值,单选是传Object,多选时传Array,默认null
isMulti: false, // 是否多选,(默认:false)
singleCancel: true, // 单选模式下,是否可取消选中
showTitle: false, // 是否显示title(默认:true)
title: '弹出选择', // 标题(默认:日期选择)
titlePadding: '32rpx', // 标题 padding(默认:32rpx)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sadais-piui",
"version": "1.0.1",
"version": "1.0.2",
"description": "piui组件库",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit b6f7481

Please sign in to comment.