Skip to content

Commit

Permalink
xAddress:Add prop:show to control visibility (#1848)
Browse files Browse the repository at this point in the history
  • Loading branch information
wg5946 authored Aug 16, 2017
1 parent b463867 commit edf3d79
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/components/x-address/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
:cancel-text="cancelText"
:display-format="displayFormat"
:popup-style="popupStyle"
:show="show"
@on-shadow-change="onShadowChange">
<template slot="title" scope="props">
<slot name="title" :label-class="props.labelClass" :label-style="props.labelStyles" :label-title="props.title">
Expand Down Expand Up @@ -63,7 +64,8 @@ export default {
type: Function,
default: (val, names) => names
},
popupStyle: Object
popupStyle: Object,
show: Boolean
},
created () {
if (this.currentValue.length && this.rawValue) {
Expand Down
12 changes: 11 additions & 1 deletion src/components/x-address/metas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ props:
type: Object
en: popup style
zh-CN: 弹窗样式,可以用于强制指定 z-index
show:
version: next
type: Boolean
en: popup show
zh-CN: 显示
slots:
title:
version: v2.3.8
Expand All @@ -125,6 +130,11 @@ events:
en: emits when picker value is changed
zh-CN: picker 值变化时触发,即滑动 picker 时触发
changes:
next:
en:
- '[feature] Add prop:show to control visibility'
zh-CN:
- '[feature] 新增 prop:show 控制是否显示'
v2.5.6:
en:
- '[feature] Support event:on-shadow-change #1778'
Expand Down Expand Up @@ -176,4 +186,4 @@ changes:
- '[fix] fix `label` styles not conform to `group` settings'
zh-CN:
- '[feature] 支持`value-text-align` #921 @linhaobin'
- '[fix] 修复`label`样式不受控于`group`属性的bug'
- '[fix] 修复`label`样式不受控于`group`属性的bug'
7 changes: 5 additions & 2 deletions src/demos/XAddress.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<group>
<x-address @on-hide="logHide" @on-show="logShow" :title="title" v-model="value" :list="addressData" @on-shadow-change="onShadowChange" placeholder="请选择地址" inline-desc="可以设置placeholder"></x-address>
<x-address @on-hide="logHide" @on-show="logShow" :title="title" v-model="value" :list="addressData" @on-shadow-change="onShadowChange" placeholder="请选择地址" inline-desc="可以设置placeholder" :show="showAddress"></x-address>
<cell title="上面value值" :value="value"></cell>
</group>

Expand All @@ -22,6 +22,7 @@
</group>
<br/>
<div style="padding: 0 15px;">
<x-button type="primary" @click.native="showAddress=true">显示</x-button>
<x-button type="primary" @click.native="changeData">改变数据(通过 id)</x-button>
<x-button type="primary" @click.native="changeDataByLabels">改变数据(通过文字值)</x-button>
<x-button type="primary" @click.native="changeDataByLabels2">改变数据(两级,通过文字值)</x-button>
Expand Down Expand Up @@ -64,7 +65,8 @@ export default {
value3: ['广东省', '中山市', '--'],
addressData: ChinaAddressV3Data,
value4: [],
value5: ['广东省', '深圳 市', '南山区']
value5: ['广东省', '深圳 市', '南山区'],
showAddress: false
}
},
methods: {
Expand All @@ -85,6 +87,7 @@ export default {
},
logHide (str) {
console.log('on-hide', str)
this.showAddress = false
},
logShow (str) {
console.log('on-show')
Expand Down

0 comments on commit edf3d79

Please sign in to comment.