Skip to content

Commit

Permalink
confirm: Support method:setInputValue for plugin (Close #1846)
Browse files Browse the repository at this point in the history
  • Loading branch information
airyland committed Aug 16, 2017
1 parent 27bbb10 commit b463867
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/confirm/metas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ extra: |
onCancel () {}
onConfirm () {}
})
// 设置输入值
this.$vux.confirm.setInputValue('value') // 注意需要在 onShow 事件中执行
```
props:
show:
Expand Down Expand Up @@ -123,6 +125,11 @@ methods:
en: set input value when show-input is true
zh-CN: 设置输入值,当 show-input 为 true 时有效
changes:
next:
en:
- '[feature] Support method:setInputValue for plugin #1846'
zh-CN:
- '[feature] 插件支持 setInputValue 方法 #1846'
v2.5.7:
en:
- '[feature] Support prop:input-attrs #1799'
Expand Down
2 changes: 2 additions & 0 deletions src/demos/Confirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ export default {
this.showPlugin()
},
showPlugin3 () {
const _this = this
this.$vux.confirm.prompt('123', {
title: 'Title',
onShow () {
console.log('promt show')
_this.$vux.confirm.setInputValue('set input value')
},
onHide () {
console.log('prompt hide')
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/confirm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ const plugin = {
})
$vm.showValue = true
},
setInputValue (val) {
vue.nextTick(() => {
setTimeout(() => {
$vm.setInputValue(val)
}, 10)
})
},
prompt (placeholder, options) {
this.show(Object.assign({}, options, {
placeholder,
Expand Down

0 comments on commit b463867

Please sign in to comment.