Commit 68fe9bdc authored by linxin's avatar linxin

add

parent a0e96c18
...@@ -102,9 +102,6 @@ export default { ...@@ -102,9 +102,6 @@ export default {
let eleHeight = vm.getOffsetTop(event.target) let eleHeight = vm.getOffsetTop(event.target)
let scrollTop = Math.floor(dom.scrollTop) let scrollTop = Math.floor(dom.scrollTop)
let result = Math.floor(veiwHeight - (eleHeight - scrollTop)) let result = Math.floor(veiwHeight - (eleHeight - scrollTop))
// vm.$nextTick(function () {
// let r = document.querySelector('.keyboard-backdrop').childNodes
// })
if (result >= 256) { if (result >= 256) {
} else { } else {
let ele = document.createElement('div') let ele = document.createElement('div')
......
...@@ -86,12 +86,30 @@ export default { ...@@ -86,12 +86,30 @@ export default {
// }, // },
onFocus (event) { onFocus (event) {
// if (this.disable) return // if (this.disable) return
let vm = this
this.focused = true this.focused = true
let value = (event.target.value).trim() let value = (event.target.value).trim()
let uncurrency = this.$options.filter['uncurrency'] let uncurrency = this.$options.filter['uncurrency']
let newVal = uncurrency(value) let newVal = uncurrency(value)
event.target.value = newVal event.target.value = newVal
setTimeout(function () { setTimeout(function () {
let dom = document.querySelector('.content')
let veiwHeight = vm.getClientHeight()
let eleHeight = vm.getOffsetTop(event.target)
let scrollTop = Math.floor(dom.scrollTop)
let result = Math.floor(veiwHeight - (eleHeight - scrollTop))
if (result >= 256) {
} else {
let ele = document.createElement('div')
ele.setAttribute('class', 'add-height')
ele.style.height = (256 - result) + 'px'
ele.style.background = '#fff'
// setTimeout(() => {
dom.appendChild(ele)
// }, 100)
dom.scrollTo(dom.scrollLeft, scrollTop + (256 - result))
}
console.log(veiwHeight, eleHeight, scrollTop, result)
event.target.type = 'text' event.target.type = 'text'
event.target.value = newVal event.target.value = newVal
// event.target.focus() // event.target.focus()
...@@ -99,6 +117,9 @@ export default { ...@@ -99,6 +117,9 @@ export default {
}, },
onBlur (event) { onBlur (event) {
// if (this.disable) return // if (this.disable) return
if (document.querySelector('.add-height')) {
document.querySelector('.content').removeChild(document.querySelector('.add-height'))
}
event.target.type = 'text' event.target.type = 'text'
this.focused = false this.focused = false
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment