Browse Source

fix

tags/v1.0.1
3136352472 5 years ago
parent
commit
50bced4fe4
  1. 21
      static/404.html
  2. 20
      static/css/main.css
  3. 36
      static/index.html
  4. 6
      static/index.js
  5. 11965
      static/js/vue.js
  6. 13
      static/ssr.vue
  7. 12
      static/template/ssr.html
  8. 29
      static/use.js

21
static/404.html

@ -0,0 +1,21 @@
<!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>

20
static/css/main.css

@ -0,0 +1,20 @@
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;
}

36
static/index.html

@ -0,0 +1,36 @@
<!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>

6
static/index.js

@ -0,0 +1,6 @@
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

13
static/ssr.vue

@ -0,0 +1,13 @@
<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>

12
static/template/ssr.html

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<title>{{ title }}</title>
</head>
<body>
<!--vue-ssr-outlet-->
</body>
</html>

29
static/use.js

@ -0,0 +1,29 @@
//公用
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模式",
},
});
});
Loading…
Cancel
Save