You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

43 lines
1.4 KiB

GV.init(function (_require) {
new (function () {
this.require = _require;
this.Vue = _require('Vue');
this.VueRouter = _require('vue-router');
this.Vue.use(this.VueRouter)
this.axios = _require('axios');
var htmlparser2 = _require('htmlparser2');
axiosUse(this);
this.qs = _require('qs');
this.GoVueMount = function (app, context) {
var ctx = GetGoVueTemplate(GoHtmlSrc)
app.$options.template = ctx.content;
// console.log(ctx.template)
var renderer = _require('vue-server-renderer').createRenderer({
template: ctx.template
})
if(!context){
context = {}
}
context.GoVueTemplate = "<go-vue-template style='display: none'>" + Base64Encode(encodeURIComponent(ctx.content)) + "</go-vue-template>"
context.GoVueData = "<go-vue-data style='display: none'>" + Base64Encode(encodeURIComponent(JSON.stringify(app.$data))) + "</go-vue-data>"
renderer.renderToString(app, context, function (err, html) {
if (err) {
throw err
} else {
GoReturn(html);
}
})
}
eval(GoUseCallback)
var codes = GetGoVueJsCode(htmlparser2, GoHtmlSrc)
for(var i in codes){
eval("with(this){" + codes[i] + "}")
}
})()
})