第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Vue JS 當(dāng)我點(diǎn)擊按鈕時(shí)我希望 div 滾動(dòng)到 div 的底部

Vue JS 當(dāng)我點(diǎn)擊按鈕時(shí)我希望 div 滾動(dòng)到 div 的底部

桃花長(zhǎng)相依 2023-12-11 16:00:40
嘿,我正在制作一個(gè)聊天機(jī)器人,但我希望當(dāng)您按 Enter 或單擊按鈕時(shí),div 滾動(dòng)到底部,因?yàn)楫?dāng)您與機(jī)器人聊天時(shí),您需要每次都向下滾動(dòng)。我有一個(gè)函數(shù),但滾動(dòng)必須在talk()函數(shù)中。這是模板代碼<template>    <div class="container">        <div class="container max">            <div class="container con">                <div class="row ml-0 mt-3">                    <p>{{this.know.welkom}}</p>                </div>               <p id="chatLog" class="chatLog font-weight-bold"></p><br>            </div>        </div>        <div class="row mt-4">            <div class="col">                <input id="userBox" class="inputChat" type="text" @keyup.enter="talk()" v-model="msg" required>            </div>            <div type="submit" value="Send" class="btn btn-primary mt-2 ml-2" @click="talk()">Send<img class="sendIcon" src="@/assets/icons/send.png"></div>        </div>    </div></template>這是我的腳本import json from './info.json';export default {    data() {        return {            title: 'Chat bot',            test: this.json,            know: {                'welkom' : '??Welcome I will help you to answer your questions. If you want more info type "help".??',                'help' : 'These are the questions that can be answerd: <br>' +                          '1?? how do you login <br>' +                         '2?? how do you register <br>' +                         '3?? how to add a internship <br>' +                         '4?? edit a internship <br>' +                         '5?? who are you',我在 之間使用了滾動(dòng)高度this.msg = '';并 console.log(this.msg);看到talk() function
查看完整描述

1 回答

?
瀟湘沐

TA貢獻(xiàn)1816條經(jīng)驗(yàn) 獲得超6個(gè)贊

要滾動(dòng)到 #chatLog div 的底部,只需執(zhí)行以下操作:

const chatLogDiv = document.getElementById('chatLog')
chatLogDiv.scrollTop = chatLogDiv.scrollHeight


查看完整回答
反對(duì) 回復(fù) 2023-12-11
  • 1 回答
  • 0 關(guān)注
  • 205 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)