File tree 6 files changed +103
-4
lines changed 6 files changed +103
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ module.exports = {
22
22
doc : [
23
23
'/doc/index' ,
24
24
] ,
25
+ docDetail : [
26
+ '/doc/detail/:id' ,
27
+ ] ,
25
28
article : [
26
29
'/article/:id' ,
27
30
] ,
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ module.exports = {
21
21
other : path . resolve ( __dirname , '../src/mp/other/main.mp.js' ) ,
22
22
me : path . resolve ( __dirname , '../src/mp/me/main.mp.js' ) ,
23
23
doc : path . resolve ( __dirname , '../src/mp/doc/main.mp.js' ) ,
24
+ docDetail : path . resolve ( __dirname , '../src/mp/docDetail/main.mp.js' ) ,
24
25
article : path . resolve ( __dirname , '../src/mp/article/main.mp.js' ) ,
25
26
} ,
26
27
output : {
Original file line number Diff line number Diff line change @@ -23,16 +23,16 @@ export default Vue.extend({
23
23
narrowImg: ' https://wechat-1251018873.file.myqcloud.com/images/narrow.png' ,
24
24
docTitleList: [{
25
25
name: ' 英文文档' ,
26
- url: ' /home ' ,
26
+ url: ' /doc/detail/docs ' ,
27
27
}, {
28
28
name: ' 中文文档' ,
29
- url: ' /me ' ,
29
+ url: ' /doc/detail/docscn ' ,
30
30
}, {
31
31
name: ' 标准库中文文档' ,
32
- url: ' /' ,
32
+ url: ' /doc/detail/pkgdoc ' ,
33
33
}, {
34
34
name: ' Go指南' ,
35
- url: ' /' ,
35
+ url: ' /doc/detail/tour ' ,
36
36
}],
37
37
}
38
38
},
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div class =" doc_detail" >
3
+ <wx-web-view :src =" url" ></wx-web-view >
4
+ </div >
5
+ </template >
6
+
7
+ <script >
8
+ import Vue from ' vue'
9
+
10
+ const docUrl = {
11
+ docs: ' https://docs.studygolang.com' ,
12
+ docscn: ' http://docscn.studygolang.com' ,
13
+ pkgdoc: ' https://studygolang.com/pkgdoc' ,
14
+ tour: ' http://tour.studygolang.com' ,
15
+ }
16
+
17
+ export default Vue .extend ({
18
+ name: ' DocDetail' ,
19
+ data () {
20
+ return {
21
+ id: ' docs' ,
22
+ url: ' https://docs.studygolang.com' ,
23
+ }
24
+ },
25
+ created () {
26
+ this .id = this .$route .params .id
27
+ this .url = docUrl[this .id ]
28
+ this .openShare (this .id )
29
+ },
30
+ methods: {
31
+ openShare (id ) {
32
+ wx .showShareMenu ({
33
+ withShareTicket: true ,
34
+ menus: [' shareAppMessage' , ' shareTimeline' ],
35
+ })
36
+ window .onShareAppMessage = (res ) => {
37
+ console .log (res)
38
+ return {
39
+ path: ` /doc/detail/${ id} ` ,
40
+ }
41
+ }
42
+ window .onShareTimeline = (res ) => {
43
+ console .log (res)
44
+ return {
45
+ path: ` /doc/detail/${ id} ` ,
46
+ }
47
+ }
48
+ }
49
+ }
50
+ })
51
+ </script >
52
+ <style lang="less">
53
+ .doc_detail {
54
+ background : #fff ;
55
+ }
56
+ </style >
Original file line number Diff line number Diff line change
1
+ import Vue from 'vue'
2
+ import Router from 'vue-router'
3
+ import { sync } from 'vuex-router-sync'
4
+ import App from '../../App.vue'
5
+ import store from '../../store'
6
+ import DocDetail from '../../docDetail/Index.vue'
7
+
8
+ Vue . use ( Router )
9
+
10
+ const router = new Router ( {
11
+ mode : 'history' ,
12
+ routes : [ {
13
+ path : '/doc/detail/:id' ,
14
+ name : 'DocDetail' ,
15
+ component : DocDetail ,
16
+ } ] ,
17
+ } )
18
+
19
+ export default function createApp ( ) {
20
+ const container = document . createElement ( 'div' )
21
+ container . id = 'app'
22
+ document . body . appendChild ( container )
23
+
24
+ Vue . config . productionTip = false
25
+
26
+ sync ( store , router )
27
+
28
+ return new Vue ( {
29
+ el : '#app' ,
30
+ router,
31
+ store,
32
+ render : h => h ( App )
33
+ } )
34
+ }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const Home = () => import(/* webpackChunkName: "Home" */'@/home/Index.vue')
5
5
const List = ( ) => import ( /* webpackChunkName: "List" */ '@/list/Index.vue' )
6
6
const Detail = ( ) => import ( /* webpackChunkName: "Detail" */ '@/detail/Index.vue' )
7
7
const Doc = ( ) => import ( /* webpackChunkName: "Doc" */ '@/doc/Index.vue' )
8
+ const DocDetail = ( ) => import ( /* webpackChunkName: "DocDetail" */ '@/docDetail/Index.vue' )
8
9
const Article = ( ) => import ( /* webpackChunkName: "Article" */ '@/article/Index.vue' )
9
10
Vue . use ( Router )
10
11
@@ -35,6 +36,10 @@ export default new Router({
35
36
name : 'Doc' ,
36
37
component : Doc ,
37
38
} , {
39
+ path : '/doc/detail/:id' ,
40
+ name : 'DocDetail' ,
41
+ component : DocDetail ,
42
+ } , {
38
43
path : '/article/:id' ,
39
44
name : 'Article' ,
40
45
component : Article ,
You can’t perform that action at this time.
0 commit comments