Skip to content

Commit

Permalink
fix: 解决在组件内定义 input 组件的 placeholder-class 无效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed Jul 4, 2019
1 parent b7c5ff9 commit 4f32a0f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/core/view/components/input/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default {
},
mounted () {
if (this.confirmType === 'search') {
var formElem = document.createElement('form')
const formElem = document.createElement('form')
formElem.action = ''
formElem.onsubmit = function () {
return false
Expand All @@ -154,6 +154,15 @@ export default {
this.$refs.wrapper.appendChild(formElem)
}
let $vm = this
while ($vm) {
const scopeId = $vm.$options._scopeId
if (scopeId) {
this.$refs.placeholder.setAttribute(scopeId, '')
}
$vm = $vm.$parent
}
this.focus && this._focusInput()
},
beforeDestroy () {
Expand Down

0 comments on commit 4f32a0f

Please sign in to comment.