{"action":"closed","issue":{"url":"https://api.github.com/repos/mipengine/mip-extensions/issues/1247","repository_url":"https://api.github.com/repos/mipengine/mip-extensions","labels_url":"https://api.github.com/repos/mipengine/mip-extensions/issues/1247/labels{/name}","comments_url":"https://api.github.com/repos/mipengine/mip-extensions/issues/1247/comments","events_url":"https://api.github.com/repos/mipengine/mip-extensions/issues/1247/events","html_url":"https://github.com/mipengine/mip-extensions/issues/1247","id":356338002,"node_id":"MDU6SXNzdWUzNTYzMzgwMDI=","number":1247,"title":"组件中customElement.prototype.firstInviewCallback 中定义的异步，页面渲染完成没有执行","user":{"login":"yxl720","id":16329468,"node_id":"MDQ6VXNlcjE2MzI5NDY4","avatar_url":"https://avatars1.githubusercontent.com/u/16329468?v=4","gravatar_id":"","url":"https://api.github.com/users/yxl720","html_url":"https://github.com/yxl720","followers_url":"https://api.github.com/users/yxl720/followers","following_url":"https://api.github.com/users/yxl720/following{/other_user}","gists_url":"https://api.github.com/users/yxl720/gists{/gist_id}","starred_url":"https://api.github.com/users/yxl720/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yxl720/subscriptions","organizations_url":"https://api.github.com/users/yxl720/orgs","repos_url":"https://api.github.com/users/yxl720/repos","events_url":"https://api.github.com/users/yxl720/events{/privacy}","received_events_url":"https://api.github.com/users/yxl720/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-03T02:16:29Z","updated_at":"2018-10-15T11:28:51Z","closed_at":"2018-10-15T11:28:51Z","author_association":"NONE","body":"**BUG 描述**\r\ncustomElement.prototype.firstInviewCallback 中定义的异步，页面渲染完成没有执行，改变下屏幕大小，才触发，下面是代码详情，\r\n`define(function (require) {\r\n    'use strict';\r\n    var $ = require('zepto');\r\n    var customElement = require('customElement').create();\r\n\r\n    /**\r\n     * 第一次进入可视区回调，只会执行一次\r\n     */\r\n    customElement.prototype.firstInviewCallback = function () {\r\n        var ele = $(this.element);\r\n        var jDiv = ele.find('.re-ul-list .help-num');\r\n        var jLength = jDiv.length;\r\n        var jQids = [];\r\n        var url = ele.attr('data-src');\r\n        var qid = ele.attr('data-qid');\r\n        var isExit = false;\r\n        // 精品咨询\r\n        if (jLength > 0) {\r\n            for (var i = 0; i < jLength; i++) {\r\n                jQids.push(jDiv.eq(i).attr('data-id'));\r\n            }\r\n        }\r\n        console.log(jQids);\r\n        $.ajax({\r\n            type: 'post',\r\n            url: url,\r\n            data: {\r\n                'qid': qid,\r\n                'jQids': jQids,\r\n                'request': 'aysn'\r\n            },\r\n            dataType: 'json',\r\n            success: function (ret) {\r\n                    if (ret.jingAsk) {\r\n                        for (var i = 0; i < jLength; i++) {\r\n                            var qid = jDiv.eq(i).attr('data-id');\r\n                            var num = ret.jingAsk[qid];\r\n                            if ('undefined' !== num && num !== '' && num !== null) {\r\n                                jDiv.eq(i).text('已帮助' + num + '人');\r\n                            } else {\r\n                                jDiv.eq(i).text('已帮助' + num + '人');\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n        });\r\n    };\r\n    return customElement;\r\n});`\r\n"}}
{"actor":{"display_login":"zqcxxx"}}