<!doctype html>if (_text[_index]== '. ') {$ (' #text '). HTML (_div+_text[_index] + ' <br> ')}
if (_text.length = = _index+1) {clearinterval (TID); } _index++; },100) </script>
Index.js
Get an App instance
var app = Getapp ()
Page ({
Data: {
Text: '
},
Onload:function () {
},
Onshow:function () {
var _data = This.data;
var _this = this;
var _text = ' blog World \nabc\-blog \n\ World Rankings-NetEase cloud reading. The best and most complete online free reading blog World website. Support Mobile reading support mobile reading support mobile phone reading support mobile reading ';
var _index = 0;
var tid = setinterval (function () {
var _div = _data.text;
_div = _div + _text[_index]
_this.setdata ({
Text: _div
})
Console.log (_div)
if (_text[_index] = = '. ‘) {
_div = _div + _text[_index] + ' <br> '
}
if (_text.length = = _index + 1) {
Clearinterval (TID);
}
_index++;
}, 100)
}
})
jquery achieves typewriter effect