pull/9/head
tangjinzhou 2018-01-22 18:56:58 +08:00
parent 18efe2729d
commit 06d1e63fdf
10 changed files with 95 additions and 13 deletions

View File

@ -1,16 +1,7 @@
language: node_js
sudo: required
node_js:
- 8.2.1
cache:
directories:
- node_modules
deploy:
provider: pages
skip-cleanup: true
keep-history: true
on:
branch: master
- 8.2.1
script:
- bash ./scripts/deploy-to-gh-pages.sh
env:

22
examples/demo.vue Normal file
View File

@ -0,0 +1,22 @@
<template>
<div>
<Components/>
</div>
</template>
<script>
import { Menu } from 'antd'
export default {
data () {
console.log('routes', this.$route.params)
return {}
},
components: {
Menu,
'Components': () => {
console.log(this.$route)
const { name, demo } = this.$route.params
return import(`../components/${name}/demo/index.vue`)
},
},
}
</script>

View File

@ -8,7 +8,7 @@ Vue.use(VueRouter)
Vue.component(Md.name, Md)
const router = new VueRouter({
mode: 'history',
mode: 'hash',
routes,
})
new Vue({

View File

@ -1,3 +1,4 @@
import Demo from './demo'
const AsyncComp = () => {
const pathnameArr = window.location.pathname.split('/')
const com = pathnameArr[1] || 'button' // eslint-disable-line
@ -7,5 +8,6 @@ const AsyncComp = () => {
}
}
export default [
{ path: '/*', component: AsyncComp },
{ path: '/components/:name/:demo?', component: Demo },
// { path: '/*', component: AsyncComp },
]

View File

@ -18,7 +18,7 @@ cd dist
git init
git add -f .
git commit -m "Travis build"
git push --force --quiet https://${GITHUB_TOKEN}@github.com/vueComponent/ant-design.git master:gh-pages > /dev/null
git push --force --quiet "https://${GITHUB_TOKEN}@github.com/vueComponent/ant-design.git" master:gh-pages > /dev/null
echo "Done updating gh-pages\n"

12
site/index.html Normal file
View File

@ -0,0 +1,12 @@
<!doctype html>
<html>
<head>
</head>
<body>
<div id="app">
<router-view></router-view>
</div>
</body>
</html>

17
site/index.js Normal file
View File

@ -0,0 +1,17 @@
import 'antd/style.js'
import './index.less'
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import Md from './md'
Vue.use(VueRouter)
Vue.component(Md.name, Md)
const router = new VueRouter({
mode: 'hash',
routes,
})
new Vue({
el: '#app',
router,
})

3
site/index.less Normal file
View File

@ -0,0 +1,3 @@
#app {
padding: 50px;
}

24
site/md.vue Normal file
View File

@ -0,0 +1,24 @@
<template>
<div style="padding: 10px 0;" v-html="marked($slots.default[0].text.trim() || '')" />
</template>
<script>
import marked from 'marked'
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: true,
sanitize: true,
smartLists: true,
smartypants: true,
})
export default {
name: 'md',
data () {
return {
marked,
}
},
}
</script>

11
site/routes.js Normal file
View File

@ -0,0 +1,11 @@
const AsyncComp = () => {
const pathnameArr = window.location.pathname.split('/')
const com = pathnameArr[1] || 'button' // eslint-disable-line
const demo = pathnameArr[2] || 'index'
return {
component: import(`../components/card/demo/${demo}.vue`),
}
}
export default [
{ path: '/*', component: AsyncComp },
]