Thanks to visit codestin.com
Credit goes to github.com

Skip to content

#30, 轮播图样式微调 #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build/miniprogram.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ module.exports = {
doc: [
'/doc/index',
],
docDetail: [
'/doc/detail/:id',
],
article: [
'/article/:id',
],
Expand Down
1 change: 1 addition & 0 deletions build/webpack.mp.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
other: path.resolve(__dirname, '../src/mp/other/main.mp.js'),
me: path.resolve(__dirname, '../src/mp/me/main.mp.js'),
doc: path.resolve(__dirname, '../src/mp/doc/main.mp.js'),
docDetail: path.resolve(__dirname, '../src/mp/docDetail/main.mp.js'),
article: path.resolve(__dirname, '../src/mp/article/main.mp.js'),
},
output: {
Expand Down
8 changes: 4 additions & 4 deletions src/doc/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ export default Vue.extend({
narrowImg: 'https://wechat-1251018873.file.myqcloud.com/images/narrow.png',
docTitleList: [{
name: '英文文档',
url: '/home',
url: '/doc/detail/docs',
}, {
name: '中文文档',
url: '/me',
url: '/doc/detail/docscn',
}, {
name: '标准库中文文档',
url: '/',
url: '/doc/detail/pkgdoc',
}, {
name: 'Go指南',
url: '/',
url: '/doc/detail/tour',
}],
}
},
Expand Down
56 changes: 56 additions & 0 deletions src/docDetail/Index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<template>
<div class="doc_detail">
<wx-web-view :src="url"></wx-web-view>
</div>
</template>

<script>
import Vue from 'vue'

const docUrl = {
docs: 'https://docs.studygolang.com',
docscn: 'http://docscn.studygolang.com',
pkgdoc: 'https://studygolang.com/pkgdoc',
tour: 'http://tour.studygolang.com',
}

export default Vue.extend({
name: 'DocDetail',
data() {
return {
id: 'docs',
url: 'https://docs.studygolang.com',
}
},
created() {
this.id = this.$route.params.id
this.url = docUrl[this.id]
this.openShare(this.id)
},
methods: {
openShare(id) {
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline'],
})
window.onShareAppMessage = (res) => {
console.log(res)
return {
path: `/doc/detail/${id}`,
}
}
window.onShareTimeline = (res) => {
console.log(res)
return {
path: `/doc/detail/${id}`,
}
}
}
}
})
</script>
<style lang="less">
.doc_detail {
background: #fff;
}
</style>
36 changes: 19 additions & 17 deletions src/home/Index.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<template>
<div class="home">
<KSwiper
:indicator-dots="indicatorDots"
:circular="circularFlag"
:autoplay="autoplay"
:duration="duration"
:interval="interval"
>
<KSwiperItem v-for="(item,index) in background" :key="index">
<KView :class="'swiper-item '+ item">
<img :src="item" class="banner-item" mode='widthFix'/>
</KView>
</KSwiperItem>
</KSwiper>
<div class="swiper">
<KSwiper
:indicator-dots="indicatorDots"
:circular="circularFlag"
:autoplay="autoplay"
:duration="duration"
:interval="interval"
>
<KSwiperItem v-for="(item,index) in background" :key="index">
<KView :class="'swiper-item '+ item">
<img :src="item" class="banner-item" mode='widthFix'/>
</KView>
</KSwiperItem>
</KSwiper>
</div>
<Tabs />

<!-- <tabs></tabs>
Expand Down Expand Up @@ -119,14 +121,14 @@ export default Vue.extend({
}
}
.swiper {
margin-top: 15px;
margin-top: 20rpx;
width: 100%;
height: 185px;
height: 300rpx;
}
.banner-item {
display: block;
margin: auto;
height: 160px;
border-radius: 20px;
width: 95%;
border-radius: 20rpx;
}
</style>
34 changes: 34 additions & 0 deletions src/mp/docDetail/main.mp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import Vue from 'vue'
import Router from 'vue-router'
import { sync } from 'vuex-router-sync'
import App from '../../App.vue'
import store from '../../store'
import DocDetail from '../../docDetail/Index.vue'

Vue.use(Router)

const router = new Router({
mode: 'history',
routes: [{
path: '/doc/detail/:id',
name: 'DocDetail',
component: DocDetail,
}],
})

export default function createApp() {
const container = document.createElement('div')
container.id = 'app'
document.body.appendChild(container)

Vue.config.productionTip = false

sync(store, router)

return new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
}
5 changes: 5 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const Home = () => import(/* webpackChunkName: "Home" */'@/home/Index.vue')
const List = () => import(/* webpackChunkName: "List" */'@/list/Index.vue')
const Detail = () => import(/* webpackChunkName: "Detail" */'@/detail/Index.vue')
const Doc = () => import(/* webpackChunkName: "Doc" */'@/doc/Index.vue')
const DocDetail = () => import(/* webpackChunkName: "DocDetail" */'@/docDetail/Index.vue')
const Article = () => import(/* webpackChunkName: "Article" */'@/article/Index.vue')
Vue.use(Router)

Expand Down Expand Up @@ -35,6 +36,10 @@ export default new Router({
name: 'Doc',
component: Doc,
}, {
path: '/doc/detail/:id',
name: 'DocDetail',
component: DocDetail,
},{
path: '/article/:id',
name: 'Article',
component: Article,
Expand Down