document.addEventListener("DOMContentLoaded", function() { //把对象赋值到JS中 try { new QWebChannel(qt.webChannelTransport, function(channel) { window.pyjs = channel.objects.Bridge; console.log("回调成功"); app.get_msg_list(); }); } catch (e) { } }); var app; $(function() { new VConsole(); app = new Vue({ el: "#app", data: { msg_list: [], }, methods: { get_msg_list: function() { http_util.list_msg(function(res){ console.log(res) res = JSON.parse(res); console.log(res) if(res.code==0){ app.msg_list = res.data; } }); } } }); });