TypeError: 'undefined' is not a function (evaluating 'u.push.bind(u)')
发布于 4 年前 作者 yakczh 2605 次浏览 来自 分享
 
var webPage = require('webpage');
var page = webPage.create();
page.onResourceReceived = function(response) {
  console.log('Response (#' + response.id + ', stage "' + response.stage + '"): ' + response.url);
};

var url='https://v.alltuu.com/album/1044306477/1017026202/';
page.open(url, function start(status) {
  page.render('snap.jpeg', {format: 'jpeg', quality: '100'});
  phantom.exit();
});

用phanttomjs抓 vue生成的页面出错 ,报错

$ phantomjs  test.js                                                                      
Response (#1, stage "start"): https://v.alltuu.com/album/1044306477/1017026202/           
Response (#1, stage "end"): https://v.alltuu.com/album/1044306477/1017026202/             
Response (#2, stage "start"): https://ms.alltuu.com/cdn/axios.min.js                      
Response (#2, stage "end"): https://ms.alltuu.com/cdn/axios.min.js                        
Response (#4, stage "start"): https://ms.alltuu.com/cdn/vuex.min.js                       
Response (#4, stage "end"): https://ms.alltuu.com/cdn/vuex.min.js                         
Response (#3, stage "start"): https://ms.alltuu.com/cdn/vue.js                            
Response (#6, stage "start"): https://ms.alltuu.com/cdn/vue-i18n.min.js                   
Response (#5, stage "start"): https://ms.alltuu.com/cdn/vue-router.min.js                 
Response (#6, stage "end"): https://ms.alltuu.com/cdn/vue-i18n.min.js                     
Response (#5, stage "end"): https://ms.alltuu.com/cdn/vue-router.min.js                   
Response (#7, stage "start"): https://ms.alltuu.com/album/css/app.6e4cd5d1.css            
Response (#7, stage "end"): https://ms.alltuu.com/album/css/app.6e4cd5d1.css              
Response (#9, stage "start"): https://ms.alltuu.com/album/js/app.28ac7463.js              
Response (#3, stage "end"): https://ms.alltuu.com/cdn/vue.js                              
Response (#8, stage "start"): https://ms.alltuu.com/album/js/chunk-vendors.a527353d.js    
Response (#9, stage "end"): https://ms.alltuu.com/album/js/app.28ac7463.js                
Response (#8, stage "end"): https://ms.alltuu.com/album/js/chunk-vendors.a527353d.js      
TypeError: 'undefined' is not a function (evaluating 'u.push.bind(u)')                    
                                                                                          
  https://ms.alltuu.com/album/js/app.28ac7463.js:1                                        
  https://ms.alltuu.com/album/js/app.28ac7463.js:1                                        
                                                                                          

u.push.bind(u) 这是什么用法 是不是phantomjs不支持 浏览器打开页面是可以运行的

4 回复

我也 不懂,帮顶

phantomjs 和浏览器都支持,就是函数绑定啊。你还是把具体的错误信息贴出来吧

image.png vue源码里看到过这个注释

回到顶部