完美解決移動端input輸入時,頁面被頂起不回落問題

html:

              <input
                @input="iptName($event)"
                class="appoint-form-text"
                maxlength="50"
                type="text"
                v-model="name"
                placeholder="請輸入您的姓名(選填)"
                @blur="blurIn"
              />

 

js:

computed: {
    scrollHeight() {
      return document.documentElement.scrollTop || document.body.scrollTop || 0;
    }
},


methods: {
    blurIn() {
      window.scrollTo(0, Math.max(this.scrollHeight - 1, 0));
    },
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章