新增路由初始

pull/30/head
陶士涵 5 years ago
parent 79bebca012
commit 42500db064

@ -7,6 +7,7 @@
<title>GO-IMAP网页版邮箱imap工具</title> <title>GO-IMAP网页版邮箱imap工具</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/theme-chalk/index.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/theme-chalk/index.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router/dist/vue-router.js"></script>
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/index.js"></script> <script src="https://cdn.jsdelivr.net/npm/element-ui@2.13.1/lib/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<style> <style>
@ -89,12 +90,27 @@
:total="mailTotal"> :total="mailTotal">
</el-pagination> </el-pagination>
</el-main> </el-main>
<router-view></router-view>
</el-container> </el-container>
</template> </template>
<template id="mailList">
<div>aaa</div>
</template>
</div> </div>
</body> </body>
<script> <script>
const list = { template: mailList };
const view = { template: '<div>bbb</div>' };
const routes = [
{ path: '/', component: list },
{ path: '/view', component: view }
];
const router = new VueRouter({
routes // (缩写) 相当于 routes: routes
})
new Vue({ new Vue({
router,
el: '#app', el: '#app',
delimiters:["<{","}>"], delimiters:["<{","}>"],
data: { data: {

@ -1,6 +1,7 @@
package tmpl package tmpl
import ( import (
"github.com/taoshihan1991/imaptool/tools"
"html/template" "html/template"
"net/http" "net/http"
) )
@ -71,6 +72,7 @@ func RenderView(w http.ResponseWriter, render interface{}) {
</body> </body>
</html> </html>
` `
t, _ := template.New("view").Parse(html) html1:=tools.FileGetContent("html/view.html")
t, _ := template.New("view").Parse(html1)
t.Execute(w, render) t.Execute(w, render)
} }

Loading…
Cancel
Save