3136352472
5 years ago
26 changed files with 171229 additions and 192114 deletions
-
90govue/bindata.go
-
2govue/cmd/main.go
-
11govue/govue-js-src/build.js
-
1govue/govue-js-src/domino
-
8govue/govue-js-src/package.json
-
3govue/govue-js-src/predo.js
-
174govue/govue-js-src/src/index.js
-
47govue/govue-js-src/test.js
-
91003govue/govue-runtime/govue-dev.js
-
91071govue/govue-runtime/govue-release.js
-
36govue/govue-runtime/header.js
-
7govue/govue-runtime/runtime.js
-
8959govue/govue-runtime/vuessr.js
-
39govue/govue.go
-
28jsruntime/runtime.go
-
1pool/pool.go
-
1readme.md
-
21static/404.html
-
20static/css/main.css
-
36static/index.html
-
6static/index.js
-
11965static/js/vue.js
-
13static/ssr.vue
-
29static/use.js
90
govue/bindata.go
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,8 +1,9 @@ |
|||
var fs = require("fs"); |
|||
var content = fs.readFileSync("./dist/index.js") |
|||
var content = fs.readFileSync("./dist/govue-release.js") |
|||
|
|||
|
|||
// content = content.toString().replace(`_m("`, `this._m("`).replace(`var isHTMLTag = `, `var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title');var _isHTMLTag = `)
|
|||
// content = content.toString().replace(`'production'`).replace(`"development"`)
|
|||
|
|||
// fs.writeFileSync("./dist/index.js", content)
|
|||
|
|||
|
@ -1,47 +0,0 @@ |
|||
global.domino = null |
|||
global.window = null |
|||
global.document = null |
|||
global.location = null |
|||
global.Vue = null |
|||
global.VueRouter = null |
|||
global.axios = null |
|||
navigator = null |
|||
|
|||
require("./dist/index") |
|||
|
|||
var html = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title>Title</title>\n</head>\n<body>\n<div id=\"classifyer\">\n code : {{code}}\n <li v-for=\"todo in data\">\n classifyer_id :{{ todo.classifyer_id }}\n name :{{ todo.name }}\n </li>\n</div>\n</body>\n</html>" |
|||
|
|||
window = domino.createWindow(html, "http://127.0.0.1/#/detail/?id=123"); |
|||
document = window.document; |
|||
location = window.location; |
|||
|
|||
|
|||
var vue = new Vue({ |
|||
el: "#classifyer", |
|||
data: function(){ |
|||
return { |
|||
code: 212123213123, |
|||
data: [ |
|||
{ name: "1asdasdasd23" } |
|||
] |
|||
} |
|||
} |
|||
}); |
|||
|
|||
|
|||
console.log(document.innerHTML); |
|||
|
|||
Vue.axios.get('/user', { |
|||
params: { |
|||
ID: 12345 |
|||
} |
|||
}) |
|||
.then(function (response) { |
|||
console.log(response); |
|||
}) |
|||
.catch(function (error) { |
|||
console.log(error); |
|||
}) |
|||
.then(function () { |
|||
// always executed
|
|||
}); |
91003
govue/govue-runtime/govue-dev.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
91071
govue/govue-runtime/govue-release.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
8959
govue/govue-runtime/vuessr.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,21 +0,0 @@ |
|||
<!doctype html> |
|||
<html lang="zh"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<meta name="keywords" content=""> |
|||
<link rel="stylesheet" href="css/main.css"> |
|||
<script src="js/vue.min.js"></script> |
|||
</head> |
|||
|
|||
<body> |
|||
<div id="app" class="content"> |
|||
<my-title></my-title> |
|||
<a>404 找不到页面</a> |
|||
</div> |
|||
</body> |
|||
<script gv-src> |
|||
new Vue({ |
|||
el: "#app", |
|||
}); |
|||
</script> |
|||
</html> |
@ -1,20 +0,0 @@ |
|||
html, body { |
|||
margin: 0; |
|||
padding: 0; |
|||
color: #888888; |
|||
} |
|||
|
|||
.content { |
|||
text-align: center; |
|||
} |
|||
|
|||
|
|||
.content h1 { |
|||
font-size: 68px; |
|||
} |
|||
.content p { |
|||
font-size: 28px; |
|||
} |
|||
pre { |
|||
width: 300px; |
|||
} |
@ -1,36 +0,0 @@ |
|||
<!doctype html> |
|||
<html lang="zh" gv-id="index"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<meta name="keywords" content=""> |
|||
<link rel="stylesheet" href="css/main.css"> |
|||
<script src="js/vue.js"></script> |
|||
</head> |
|||
|
|||
<body> |
|||
<div id="app"> |
|||
<div class="content"> |
|||
<my-title></my-title> |
|||
<a v-on:click="click" gv-ignore>{{desc}}</a> |
|||
<br> |
|||
<br> |
|||
<br> |
|||
<a href="#" v-on:click="ssr" gv-ignore>{{a}}</a> |
|||
</div> |
|||
</div> |
|||
</body> |
|||
<script> |
|||
new Vue({ |
|||
el: "#app", |
|||
methods: { |
|||
click: function () { |
|||
alert("点击触发"); |
|||
}, |
|||
ssr: function () { |
|||
location.href = "ssr.html?test" |
|||
}, |
|||
} |
|||
}); |
|||
</script> |
|||
|
|||
</html> |
@ -1,6 +0,0 @@ |
|||
new Vue({ |
|||
el: "#pre", |
|||
data: { |
|||
pre: "扩展参数\nhtml上的gv属性,值为页面id\nserc上的gv属性,表示脚本需要服务端渲染" |
|||
} |
|||
}); |
11965
static/js/vue.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,13 +0,0 @@ |
|||
<div id="app">访问的 URL 是: {{ url }}</div> |
|||
<script gv-src> |
|||
var context = { |
|||
title: 'hello' |
|||
}; |
|||
var app = new Vue({ |
|||
el:"#app", |
|||
data: { |
|||
url: location.href |
|||
} |
|||
}); |
|||
GoVueRender("template/ssr.html", app, context) |
|||
</script> |
@ -1,29 +0,0 @@ |
|||
//公用
|
|||
GoUse(function () { |
|||
|
|||
|
|||
|
|||
}); |
|||
|
|||
//分页面
|
|||
GoUseRegistered("index", function (query) { |
|||
// 定义一个名为 button-counter 的新组件
|
|||
document.title = "govue"; |
|||
|
|||
document |
|||
.getElementsByName("keywords")[0] |
|||
.setAttribute("content", "govue,服务端渲染,ssr"); |
|||
|
|||
Vue.component('my-title', { |
|||
template: '<h1 id="title">govue</h1>' |
|||
}); |
|||
|
|||
new Vue({ |
|||
el: "#app", |
|||
data: { |
|||
"desc": "基础golang开发的一套vue服务端渲染方案", |
|||
"a": "官方ssr模式", |
|||
}, |
|||
|
|||
}); |
|||
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue