Skip to content

Commit

Permalink
fix: bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HXCStudio123 authored Sep 4, 2020
1 parent 362ef6e commit f2d9640
Show file tree
Hide file tree
Showing 15 changed files with 127 additions and 59 deletions.
2 changes: 1 addition & 1 deletion examples/demo/pages/radio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</demo-block>
<demo-block title="修改形状">
<wd-radio-group v-model="value2" shape="button">
<wd-radio value="1" max-width="30px">京麦</wd-radio>
<wd-radio value="1">京麦</wd-radio>
<wd-radio value="2">商家后台</wd-radio>
</wd-radio-group>
</demo-block>
Expand Down
4 changes: 2 additions & 2 deletions examples/demo/pages/toast.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ export default {
this.$toast.success('操作成功')
},
handleToast3 () {
this.$toast.error('错误提示错误提示')
this.$toast.error('错误提示')
},
handleToast4 () {
this.$toast.warning('提示信息')
this.$toast.warning('警告信息')
},
handleToast5 () {
this.$toast({
Expand Down
31 changes: 29 additions & 2 deletions examples/docs/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,46 @@

### 2.0.0-beta3

*2020-08-25*
*2020-09-04*

#### 新特性

- Button
- click 事件抛出event对象 (by [@yawuling](https://github.com/yawuling)) )

- DatetimePicker
- 新增方法 `toggle`, 在区域选择模式下,tab标签切换时触发 (by [@HXCStudio123](https://github.com/HXCStudio123) )
- 新增属性 `display-format-tab-label`, 在区域选择模式下,自定义展示tab标签文案的格式化函数,返回一个字符串 (by [@HXCStudio123](https://github.com/HXCStudio123) )
- 修改范围选择 交互样式,将picker拆分为 tab形式 (by [@HXCStudio123](https://github.com/HXCStudio123) )
- 移除插槽 `range-separator` (by [@HXCStudio123](https://github.com/HXCStudio123) )

#### 优化

- MessageBox
- 动画时间由300ms改为200ms,减少等待时间
- Grid
- 支持动态渲染GridItem (by [@HXCStudio123](https://github.com/HXCStudio123)
- 支持列项修改后内部GridItem重排 (by [@HXCStudio123](https://github.com/HXCStudio123)
- GridItem 内容padding移除,兼容小屏幕展示四字标题 (by [@HXCStudio123](https://github.com/HXCStudio123)

#### Bug 修复

- 修复 `DatetimePicker` 当type为 'date' 时,区域选择禁用错误选项,无法修改选中问题。 (by [@HXCStudio123](https://github.com/HXCStudio123) )
- Cell
- 修复边框线样式calc计算无效问题 (by [@yawuling](https://github.com/yawuling)) )
- ColPicker
- 修复按需引入缺少actionSheet样式问题 (by [@yawuling](https://github.com/yawuling)) )
- Picker
- 修复columns数据延迟传入无法正常展示文本问题 (by [@yawuling](https://github.com/yawuling)) )
- PickerView
- 修复columns延迟传入时无法自动选中第一项的问题;修复columns延迟传入时picker重置数据的记录 (by [@yawuling](https://github.com/yawuling)) )
- Popup
- 修复按需引入popup和messageBox缺少modal样式问题 (by [@yawuling](https://github.com/yawuling)) )
- StatusTip
- 去掉占位图的白色背景,将图片从base64改为图片链接以减少包大小 (by [@yawuling](https://github.com/yawuling)) )
- Button
- 圆角按钮圆角还原度,修复2px偏差 (by [@yawuling](https://github.com/yawuling)) )
- DatetimePicker
- 修复 `DatetimePicker` 当type为 'date' 时,区域选择禁用错误选项,无法修改选中问题。 (by [@HXCStudio123](https://github.com/HXCStudio123) )

### 2.0.0-beta2

Expand Down
2 changes: 1 addition & 1 deletion examples/docs/docs/datetimePicker.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export default {
设置默认插槽修改唤起picker组件的形式。

```html
<wd-datetime-picker v-model="value" :columns="columns">
<wd-datetime-picker v-model="value">
<wd-button>插槽唤起</wd-button>
</wd-datetime-picker>
```
Expand Down
2 changes: 2 additions & 0 deletions packages/datetime-picker-view/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export default {
getPickerValue (value) {
return this.getValueArray(this.formatValue(value))
},
formatDisplay (items) {
if (this.displayFormat) return this.displayFormat(items)
Expand Down Expand Up @@ -357,6 +358,7 @@ export default {
return values
},
handleChange (pickerView, value, index) {
this.$emit('change', pickerView, value, index)
}
Expand Down
14 changes: 7 additions & 7 deletions packages/datetime-picker/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<div v-if="region" class="wd-picker__region-tabs">
<ul class="wd-picker__region" :class="showStart ? 'is-active' : ''" @click="chooseItem()">
<li>开始时间</li>
<li>{{changeLabel[0]}}</li>
<li>{{showTabLabel[0]}}</li>
</ul>
<ul
class="wd-picker__region"
:class="showStart ? '' : 'is-active'"
@click="chooseItem(false)"
>
<li>结束时间</li>
<li>{{changeLabel[1]}}</li>
<li>{{showTabLabel[1]}}</li>
</ul>
</div>
<!-- 开始 -->
Expand Down Expand Up @@ -89,7 +89,7 @@ export default {
showStart: true,
timePicker: true,
currentTarget: this,
changeLabel: [],
showTabLabel: [],
innerValue: this.region ? this.value[0] : this.value,
displayColumns: [],
end: {
Expand Down Expand Up @@ -228,7 +228,7 @@ export default {
if (this.region) {
const pickerView = index === 0 ? this.$refs.pickerView.$refs.pickerView : this.$refs.endPickerView.$refs.pickerView
const items = pickerView.getItems()
this.changeLabel[index] = this.defaultDisplayFormat(items, true)
this.showTabLabel[index] = this.defaultDisplayFormat(items, true)
}
},
Expand All @@ -241,7 +241,7 @@ export default {
const endPickerView = this.$refs.endPickerView.$refs.pickerView
const endItems = endPickerView.getItems()
label += '' + this.defaultDisplayFormat(endItems)
this.changeLabel = [this.defaultDisplayFormat(items, true), this.defaultDisplayFormat(endItems, true)]
this.showTabLabel = [this.defaultDisplayFormat(items, true), this.defaultDisplayFormat(endItems, true)]
}
this.showValue = label
},
Expand Down Expand Up @@ -335,7 +335,7 @@ export default {
const boundary = pickerView.startSymbol ? pickerView.getPickerValue(end) : pickerView.getPickerValue(start)
currentValue = pickerView.getPickerValue(currentValue)
const mapColumns = (columns, type) => {
const mapColumns = (columns) => {
// 此时index是最外层知道当前的索引即可得到当前是哪个时间段
return columns.map((column, cIndex) => {
return column.values.map((value, index) => {
Expand All @@ -350,7 +350,7 @@ export default {
})
}
return mapColumns(originColumns, pickerView.startSymbol)
return mapColumns(originColumns)
}
},
Expand Down
8 changes: 8 additions & 0 deletions packages/grid-item/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,21 @@ import WdBadge from 'wot-design/packages/badge'
export default {
name: 'WdGridItem',
inject: ['grid'],
components: {
WdBadge
},
data () {
return {
style: {},
gutterContentStyle: {},
itemClass: []
}
},
props: {
icon: {
type: String,
Expand All @@ -66,15 +70,18 @@ export default {
value: [Number, String],
max: Number
},
created () {
this.$nextTick(() => {
this.init()
})
},
methods: {
set (key, value) {
this[key] = value
},
init () {
const { length, gutter, square, column, bgColor } = this.grid
const width = column ? 100 / column + '%' : 100 / length + '%'
Expand All @@ -95,6 +102,7 @@ export default {
this.gutterContentStyle = (gutter && square) ? { right: `${gutter}px`, bottom: `${gutter}px`, backgroundColor: bgColor } : { backgroundColor: bgColor }
this.style = squareStyle || gutterStyle || { width }
},
click (event) {
if (!this.grid.clickable) return
const { to, replace } = this
Expand Down
57 changes: 39 additions & 18 deletions packages/grid/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
export default {
name: 'WdGrid',
provide () {
return {
grid: this
}
},
data () {
return {
length: ''
}
},
props: {
clickable: {
type: Boolean,
Expand All @@ -35,6 +38,7 @@ export default {
bgColor: String,
gutter: Number
},
computed: {
gridStyle () {
return this.gutter ? {
Expand All @@ -43,25 +47,42 @@ export default {
} : {}
}
},
watch: {
column () {
this.$nextTick(() => {
this.init()
})
}
},
mounted () {
const children = []
this.$slots.default.forEach(item => {
item.tag && children.push(item.child)
})
this.length = children.length
if (!this.border) return
children.forEach((item, index) => {
const { column } = this
if (column) {
const isRightItem = children.length - 1 === index || (index + 1) % column === 0
const isFirstLine = (index + 1) <= column
isFirstLine && item.itemClass.push('is-first-line')
isRightItem && item.itemClass.push('is-right')
!isFirstLine && item.itemClass.push('is-border')
} else {
item.itemClass.push('is-first-line')
}
})
this.init()
},
methods: {
init () {
const children = []
this.$slots.default.forEach(item => {
item.tag && children.push(item.child)
})
this.length = children.length
children.forEach((item, index) => {
if (this.border) {
const { column } = this
if (column) {
const isRightItem = children.length - 1 === index || (index + 1) % column === 0
const isFirstLine = (index + 1) <= column
isFirstLine && item.itemClass.push('is-first-line')
isRightItem && item.itemClass.push('is-right')
!isFirstLine && item.itemClass.push('is-border')
} else {
item.itemClass.push('is-first-line')
}
}
item.init()
})
}
}
}
</script>
14 changes: 11 additions & 3 deletions src/style/abstracts/_variable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ $-pagination-nav-sepatator-padding: 0 4px !default;
$-pagination-nav-current-color: $-color-theme !default;

/* picker */
$-picker-toolbar-height: 16px !default; // toolbar 操作条的高度
$-picker-toolbar-height: 54px !default; // toolbar 操作条的高度
$-picker-action-height: 16px !default; // toolbar 操作条的高度
$-picker-toolbar-finish-color: $-color-theme !default; // toolbar 操作条完成按钮的颜色
$-picker-toolbar-cancel-color: #666666 !default; // toolbar 操作条的边框颜色
Expand All @@ -429,7 +429,15 @@ $-picker-loading-button-color: rgba($-color-black, 0.25) !default; // loading
$-picker-cell-arrow-size-large: $-cell-icon-size !default; // cell 类型的大尺寸 右侧icon尺寸

$-picker-region-color: rgba($-color-black, 0.45) !default; // 区域选择文字颜色
$-picker-region-bg-active-color: #538BFF !default; // 区域选择激活选中背景颜色
$-picker-region-bg-active-color: resultColor(
$open-linear,
315deg,
$-color-theme,
"dark" "light" "light",
rgba(79,124,248,1) rgba(102,141,248,1) rgba(102,141,248,1),
0% 100% 100%
) !default; // 区域选择激活选中背景颜色

$-picker-region-fs: 14px !default; // 区域选择文字字号

/* col-picker */
Expand Down Expand Up @@ -745,7 +753,7 @@ $-popover-z-index: $-tooltip-z-index !default;

/* grid-item */
$-grid-item-fs: 12px !default; // 字号
$-grid-item-padding: 15px 10px !default; // 内容的 padding
$-grid-item-padding: 14px 0 !default; // 内容的 padding
$-grid-item-border-color: rgba($-color-black, 0.09) !default; // 边框颜色
$-grid-item-bg: $-color-white !default; // 间距

Expand Down
1 change: 1 addition & 0 deletions src/style/checkbox-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@include b(checkbox-group) {
background-color: $-checkbox-bg;
line-height: 1.2;
font-size: 0;

@include when(cell) {
.wd-checkbox {
Expand Down
6 changes: 1 addition & 5 deletions src/style/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@
margin-right: 0;
}
.wd-checkbox__shape {
width: 0;
height: 0;
overflow: hidden;
opacity: 0;
border: none;
display: none;
}
.wd-checkbox__label {
display: inline-flex;
Expand Down
Loading

0 comments on commit f2d9640

Please sign in to comment.