美文网首页
9.1settimeout要用函数闭包/

9.1settimeout要用函数闭包/

作者: 我爱吃肥肠 | 来源:发表于2017-09-02 07:02 被阅读0次

    1,setTimeout(console.log(_this.$store.state.currentuser.encrypt_key),4000)这样没有效果,改成闭包

    setTimeout(function(){

    return console.log(_this.$store.state.currentuser.encrypt_key)},4000)

    相关文章

      网友评论

          本文标题:9.1settimeout要用函数闭包/

          本文链接:https://www.haomeiwen.com/subject/uwjkjxtx.html