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", "qs": "^6.9.4",
"through": "^2.3.8", "through": "^2.3.8",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-hot-reload-api": "^2.3.4",
"vue-router": "^3.2.0", "vue-router": "^3.2.0",
"vue-server-renderer": "^2.6.11" "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'); domino = require('../domino/lib/index');
Node = require('../domino/lib/index');
// domino = require('domino');
window = domino.createWindow("", "http://127.0.0.1/"); window = domino.createWindow("", "http://127.0.0.1/");
document = window.document; document = window.document;
location = window.location; 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, var domino, window, document, location, Vue, VueRouter, vuessr, navigator, axios, Promise, GoUseCall, GoUse,
GoUseRegistered, GoUseRegistered,
govueId, useRoute, goUseCallCache, $, jQuery, GoParam, qs, Intl;
govueId, useRoute, goUseCallCache, $, jQuery, GoParam, qs, Intl, process,Node;
var global = this; var global = this;
global.Vue = Vue; global.Vue = Vue;
global.VueRouter = VueRouter; global.VueRouter = VueRouter;
global.Intl = Intl; global.Intl = Intl;
global.process = process;
global.Node = Node;
var VueDisableTag = [];
process = {
env: {
VUE_ENV: "server",
NODE_ENV: "production"
}
};
navigator = { 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 " 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() { function GetGoVueId() {
var h = document.querySelector("[gv-id]") var h = document.querySelector("[gv-id]")
var id = ""; var id = "";
if (h){
if (h) {
id = h.getAttribute("gv-id"); id = h.getAttribute("gv-id");
} }
return id; return id;
@ -286,7 +292,7 @@ var GoVueIgnoreOnEvent = function () {
}) })
}; };
if(!HTMLDecode){
if (!HTMLDecode) {
function HTMLDecode(text) { function HTMLDecode(text) {
var temp = document.createElement("div"); var temp = document.createElement("div");
@ -296,10 +302,11 @@ if(!HTMLDecode){
return output; return output;
} }
} }
function GoVueRestoreRawTemplate(){
function GoVueRestoreRawTemplate() {
var template = document.getElementsByTagName("gv-template-html"); var template = document.getElementsByTagName("gv-template-html");
for(var i in template){
for (var i in template) {
template[i].outerHTML = HTMLDecode(template[i].innerHTML); template[i].outerHTML = HTMLDecode(template[i].innerHTML);
} }
} }

2
govue/govue-runtime/runtime.js

@ -49,7 +49,7 @@ if (!IS_VUE_SSR) {
} }
try { try {
GoVueRestoreRawTemplate();
GoVueRestoreRawTemplate();
} catch (e) { } catch (e) {
console.log("GoVueRestoreRawTemplate:" + 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" 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 { if err != nil {
return 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 { if err != nil {
return return
} }
govueScript, err := gv.Resources.Asset(filepath.Join("govue-runtime", govueScriptFile))
govueScript, err := ioutil.ReadFile(filepath.Join("govue", "govue-runtime", govueScriptFile))
if err != nil { if err != nil {
return 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 { if err != nil {
return 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{ gv.jsRuntimePool = pool.NewJsRuntimePool(string(mainScript), gv.UseJsPath, gv.StaticPath, jsruntime.Relys{
jsruntime.Rely{ jsruntime.Rely{
Src: string(polyfill), 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) { err = jr.Render(filePath, fmt.Sprintf("http://%s%s", request.Host, request.RequestURI), string(result), goExtData, func(data string) {
result = []byte(data) result = []byte(data)
}) })
if err != nil {
result = []byte(err.Error())
}
}) })
return return

1
jsruntime/runtime.go

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

2
jsruntime/timeout.go

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

Loading…
Cancel
Save