vue2 el-input里实现打字机 效果

vue2 el-input里实现打字机 效果


                    
                        
                    
                

                    
                            
script
data
isTypingOtherDesc: false,
            ifshowOtherDesc:true,
            typingTextsOtherDesc: [],
method
doDelayOtherDesc() {
            let that = this;
            setTimeout(()=>{
                this.ruleForm.otherDesc = this.typingTextsOtherDesc.toString();
                 that.isTypingOtherDesc = false;
                 that.ifshowOtherDesc = true;
            },300)
                
        },

通过假打字 @onComplete=“doDelayOtherDesc” 监听结束时赋值,关闭打字机的div 显示el-input,实现无缝切换的 gpt打字效果。

1.typingTextsOtherDesc=[‘111111’,‘22222’]
打字机需要的字符格式是数组里有字符串的格式。赋值给input需要toString() 转字符串。不然maxlength=“3000” :rows=“4” show-word-limit
的input data赋值会显示1/3000而非实际字数。
2.换行 需要后端在字符里+ \n换行

你可能感兴趣的:(vue.js,前端,javascript)