Browse Source

fix

tags/v1.0.1
郑荣升 5 years ago
parent
commit
99b3b051f5
  1. 2
      govue/govue-js-src/domino
  2. 1
      govue/govue-js-src/package.json
  3. 2
      govue/govue-js-src/src/index.js
  4. 782
      govue/govue-runtime/govue-dev.js
  5. 782
      govue/govue-runtime/govue-release.js
  6. 21
      govue/govue-runtime/header.js
  7. 2
      govue/govue-runtime/runtime.js
  8. 51
      govue/govue.go
  9. 1
      jsruntime/runtime.go
  10. 2
      jsruntime/timeout.go

2
govue/govue-js-src/domino

@ -1 +1 @@
Subproject commit e543301316335417ae43e5e645361fe2669fd05b
Subproject commit 91d80b72bce7c7361823eb5403ada13d878702db

1
govue/govue-js-src/package.json

@ -15,6 +15,7 @@
"qs": "^6.9.4",
"through": "^2.3.8",
"vue": "^2.6.11",
"vue-hot-reload-api": "^2.3.4",
"vue-router": "^3.2.0",
"vue-server-renderer": "^2.6.11"
},

2
govue/govue-js-src/src/index.js

@ -2,6 +2,8 @@ process = require('process');
domino = require('../domino/lib/index');
Node = require('../domino/lib/index');
// domino = require('domino');
window = domino.createWindow("", "http://127.0.0.1/");
document = window.document;
location = window.location;

782
govue/govue-runtime/govue-dev.js
File diff suppressed because it is too large
View File

782
govue/govue-runtime/govue-release.js
File diff suppressed because it is too large
View File

21
govue/govue-runtime/header.js

@ -1,13 +1,19 @@
var domino, window, document, location, Vue, VueRouter, vuessr, navigator, axios, Promise, GoUseCall, GoUse,
GoUseRegistered,
govueId, useRoute, goUseCallCache, $, jQuery, GoParam, qs, Intl;
govueId, useRoute, goUseCallCache, $, jQuery, GoParam, qs, Intl, process,Node;
var global = this;
global.Vue = Vue;
global.VueRouter = VueRouter;
global.Intl = Intl;
global.process = process;
global.Node = Node;
var VueDisableTag = [];
process = {
env: {
VUE_ENV: "server",
NODE_ENV: "production"
}
};
navigator = {
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 a/537.36 "
};
@ -132,7 +138,7 @@ function LoadPage(src, href) {
function GetGoVueId() {
var h = document.querySelector("[gv-id]")
var id = "";
if (h){
if (h) {
id = h.getAttribute("gv-id");
}
return id;
@ -286,7 +292,7 @@ var GoVueIgnoreOnEvent = function () {
})
};
if(!HTMLDecode){
if (!HTMLDecode) {
function HTMLDecode(text) {
var temp = document.createElement("div");
@ -296,10 +302,11 @@ if(!HTMLDecode){
return output;
}
}
function GoVueRestoreRawTemplate(){
function GoVueRestoreRawTemplate() {
var template = document.getElementsByTagName("gv-template-html");
for(var i in template){
for (var i in template) {
template[i].outerHTML = HTMLDecode(template[i].innerHTML);
}
}

2
govue/govue-runtime/runtime.js

@ -49,7 +49,7 @@ if (!IS_VUE_SSR) {
}
try {
GoVueRestoreRawTemplate();
GoVueRestoreRawTemplate();
} catch (e) {
console.log("GoVueRestoreRawTemplate:" + e);

51
govue/govue.go

@ -67,46 +67,46 @@ func (gv *GoVue) initRender(debug bool) (err error) {
govueScriptFile = "govue-dev.js"
}
//polyfill, err := ioutil.ReadFile(filepath.Join("govue", "govue-runtime", "polyfill.js"))
//if err != nil {
// return
//}
//
//headerScript, err := ioutil.ReadFile(filepath.Join("govue", "govue-runtime", "header.js"))
//if err != nil {
// return
//}
//
//govueScript, err := ioutil.ReadFile(filepath.Join("govue", "govue-runtime",govueScriptFile))
//if err != nil {
// return
//}
//
//mainScript, err := ioutil.ReadFile(filepath.Join("govue", "govue-runtime", "runtime.js"))
//if err != nil {
// return
//}
polyfill, err := gv.Resources.Asset(filepath.Join("govue-runtime", "polyfill.js"))
polyfill, err := ioutil.ReadFile(filepath.Join("govue", "govue-runtime", "polyfill.js"))
if err != nil {
return
}
headerScript, err := gv.Resources.Asset(filepath.Join("govue-runtime", "header.js"))
headerScript, err := ioutil.ReadFile(filepath.Join("govue", "govue-runtime", "header.js"))
if err != nil {
return
}
govueScript, err := gv.Resources.Asset(filepath.Join("govue-runtime", govueScriptFile))
govueScript, err := ioutil.ReadFile(filepath.Join("govue", "govue-runtime", govueScriptFile))
if err != nil {
return
}
mainScript, err := gv.Resources.Asset(filepath.Join("govue-runtime", "runtime.js"))
mainScript, err := ioutil.ReadFile(filepath.Join("govue", "govue-runtime", "runtime.js"))
if err != nil {
return
}
//polyfill, err := gv.Resources.Asset(filepath.Join("govue-runtime", "polyfill.js"))
//if err != nil {
// return
//}
//
//headerScript, err := gv.Resources.Asset(filepath.Join("govue-runtime", "header.js"))
//if err != nil {
// return
//}
//
//govueScript, err := gv.Resources.Asset(filepath.Join("govue-runtime", govueScriptFile))
//if err != nil {
// return
//}
//
//mainScript, err := gv.Resources.Asset(filepath.Join("govue-runtime", "runtime.js"))
//if err != nil {
// return
//}
gv.jsRuntimePool = pool.NewJsRuntimePool(string(mainScript), gv.UseJsPath, gv.StaticPath, jsruntime.Relys{
jsruntime.Rely{
Src: string(polyfill),
@ -204,6 +204,9 @@ func (gv *GoVue) LoadStaticResources(request *http.Request, goExtDataS ...interf
err = jr.Render(filePath, fmt.Sprintf("http://%s%s", request.Host, request.RequestURI), string(result), goExtData, func(data string) {
result = []byte(data)
})
if err != nil {
result = []byte(err.Error())
}
})
return

1
jsruntime/runtime.go

@ -269,6 +269,7 @@ func (jr *JsRuntime) Render(filePath, href, tplSrc string, GoExtData interface{}
err = jr.RunCode(mainSrc)
if err != nil {
jr.PrintError(err.Error(), "")
return err
}

2
jsruntime/timeout.go

@ -16,7 +16,7 @@ func (jr *JsRuntime) EnableTimeoutFunc() {
args = call.Arguments[2:]
}
//time.Sleep(time.Duration(delay) * time.Millisecond)
time.Sleep(time.Duration(delay) * time.Millisecond)
fn(nil, args...)
}

Loading…
Cancel
Save