m***@163.com
m***@163.com
  • 发布:2020-05-21 17:55
  • 更新:2021-11-11 10:46
  • 阅读:1703

头条小程序是否支持 this.$nextTick()

分类:uni-app
  1. 将代码编译到头条小程序平台时
    this.$nextTick(() => {
    this.$refs['pt-baseinfo'].responseData = [];
    });
    其中:this.$refs['pt-baseinfo'] 值为undefined,是头条不支持this.$nextTick吗?

  2. 如果不支持,用什么方式呢?

  3. 如果用setTimeout,那时间该设置多少呢?

2020-05-21 17:55 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

请上传一份可以运行的demo我们排查一下

  • m***@163.com (作者)

    demo已做好,见附件。(注意,我用的是HBuilder X版本为2.6.16.20200424,v2编译器)


    该问题复现流程如下:


    1.解压项目


    2.在HBuilder X菜单栏点击 运行---》运行到小程序模拟器---》字节跳动开发工具


    3.在字节跳动开发工具,点击首页--》选院校---》北京大学,从而进到北京大学详情页,在控制台即可看到如下错误:


    mp.runtime.esm.js:5813 TypeError: Cannot read property 'initialize' of undefined


    at VueComponent.eval (school-detail.vue:111)


    at Array.eval (mp.runtime.esm.js:5577)


    at flushCallbacks$1 (mp.runtime.esm.js:5544)


    at t.eval (mp.runtime.esm.js:5648)


    at Mr (eval at window.loadTmaScript (C:\Users\cunzhang\AppData\Local\Programs\bytedanceide\resources\app.asar.unpacked\simulator-sdk\dist\preload\bgPreload.13d0b64a0b71ba19a96c.js:277), <anonymous>:1:48517)


    at eval (eval at window.loadTmaScript (C:\Users\cunzhang\AppData\Local\Programs\bytedanceide\resources\app.asar.unpacked\simulator-sdk\dist\preload\bgPreload.13d0b64a0b71ba19a96c.js:277), <anonymous>:1:283861)


    at e.(:20001/static/dist/common/anonymous function) (eval at window.loadTmaScript (C:\Users\cunzhang\AppData\Local\Programs\bytedanceide\resources\app.asar.unpacked\simulator-sdk\dist\preload\bgPreload.13d0b64a0b71ba19a96c.js:277:306237), <anonymous>:1:21697)


    at Object.O (eval at window.loadTmaScript (C:\Users\cunzhang\AppData\Local\Programs\bytedanceide\resources\app.asar.unpacked\simulator-sdk\dist\preload\bgPreload.13d0b64a0b71ba19a96c.js:277), <anonymous>:1:4269)


    at C:\Users\cunzhang\AppData\Local\Programs\bytedanceide\resources\app.asar.unpacked\simulator-sdk\dist\preload\bgPreload.13d0b64a0b71ba19a96c.js:277


    at EventEmitter.<anonymous> (C:\Users\cunzhang\AppData\Local\Programs\bytedanceide\resources\app.asar.unpacked\simulator-sdk\dist\preload\bgPreload.13d0b64a0b71ba19a96c.js:277)


    at EventEmitter.emit (events.js:182)

    2020-05-22 23:31

  • m***@163.com (作者)

    更正:编译器我改成了v3,依然会出现此问题。

    2020-05-27 13:57

7***@qq.com

7***@qq.com

我也遇到了,有什么方法可以解决这个问题吗?

该问题目前已经被锁定, 无法添加新回复