chore: merge vant-doc to vant-cli

This commit is contained in:
陈嘉涵 2019-11-18 21:02:36 +08:00
parent 80c09566fe
commit b7d142322b
25 changed files with 40 additions and 218 deletions

View File

@ -51,7 +51,6 @@
"@babel/preset-env": "^7.7.1",
"@babel/preset-typescript": "^7.7.2",
"@types/jest": "^24.0.22",
"@vant/doc": "^2.6.1",
"@vant/eslint-config": "^1.4.0",
"@vant/markdown-loader": "^2.2.0",
"@vant/markdown-vetur": "^1.0.0",

View File

@ -1,4 +1,4 @@
@van-doc-black: #333;
@van-doc-black: #323233;
@van-doc-blue: #1989fa;
@van-doc-purple: #5758bb;
@van-doc-fuchsia: #a7419e;

View File

@ -7,9 +7,14 @@
</template>
<script>
import VanDoc from './components';
import { config } from '../../dist/desktop-config';
export default {
components: {
VanDoc
},
data() {
return {
config,

View File

@ -18,7 +18,7 @@ export default {
</script>
<style lang="less">
@import '../style/variable';
@import '../../common/style/index';
.van-doc-container {
box-sizing: border-box;

View File

@ -21,7 +21,7 @@ export default {
</script>
<style lang="less">
@import '../style/variable';
@import '../../common/style/index';
.van-doc-content {
position: relative;
@ -188,7 +188,7 @@ export default {
blockquote {
margin: 20px 0 0;
padding: 16px;
color: rgba(52, 73, 94, .8);
color: rgba(52, 73, 94, 0.8);
font-size: 14px;
background-color: #ecf9ff;
border-left: 5px solid #50bfff;

View File

@ -98,7 +98,7 @@ export default {
</script>
<style lang="less">
@import '../style/variable';
@import '../../common/style/index';
.van-doc-header {
width: 100%;

View File

@ -28,7 +28,7 @@
</template>
<script>
import NavLink from './NavLink.vue';
import NavLink from './NavLink';
export default {
name: 'van-doc-nav',
@ -76,7 +76,7 @@ export default {
</script>
<style lang="less">
@import '../style/variable';
@import '../../common/style/index';
.van-doc-nav {
position: fixed;

View File

@ -40,7 +40,7 @@ export default {
</script>
<style lang="less">
@import '../style/variable';
@import '../../common/style/index';
.van-doc-search {
width: 200px;

View File

@ -44,7 +44,7 @@ export default {
</script>
<style lang="less">
@import '../style/variable';
@import '../../common/style/index';
.van-doc-simulator {
position: absolute;
@ -71,7 +71,7 @@ export default {
@media (min-width: @van-doc-row-max-width) {
right: 50%;
margin-right: calc(-@van-doc-row-max-width / 2 + 40px);
margin-right: -@van-doc-row-max-width / 2 + 40px;
}
&-fixed {

View File

@ -1,20 +1,20 @@
<template>
<div class="van-doc">
<van-doc-header
<doc-header
:lang="lang"
:versions="versions"
:config="config.header"
:search-config="searchConfig"
@switch-version="$emit('switch-version', $event)"
/>
<van-doc-nav :base="base" :nav-config="config.nav" />
<van-doc-container :has-simulator="!!(simulator || simulators.length)">
<van-doc-content>
<doc-nav :base="base" :nav-config="config.nav" />
<doc-container :has-simulator="!!(simulator || simulators.length)">
<doc-content>
<slot />
</van-doc-content>
</van-doc-container>
<van-doc-simulator v-if="simulator" :src="simulator" />
<van-doc-simulator
</doc-content>
</doc-container>
<doc-simulator v-if="simulator" :src="simulator" />
<doc-simulator
v-for="(url, index) in simulators"
v-show="index === currentSimulator"
:src="url"
@ -24,9 +24,23 @@
</template>
<script>
import DocNav from './Nav';
import DocHeader from './Header';
import DocContent from './Content';
import DocContainer from './Container';
import DocSimulator from './Simulator';
export default {
name: 'van-doc',
components: {
DocNav,
DocHeader,
DocContent,
DocContainer,
DocSimulator
},
props: {
lang: String,
versions: Array,
@ -124,5 +138,5 @@ export default {
</script>
<style lang="less">
@import './style/index';
@import '../../common/style/index';
</style>

View File

@ -1,12 +1,10 @@
import Vue from 'vue';
import VueRouter from 'vue-router';
import VantDoc from '@vant/doc';
import App from './App';
import routes from './router';
import { isMobile } from '../common';
import '../common/iframe-router';
Vue.use(VantDoc);
Vue.use(VueRouter);
if (isMobile) {

View File

@ -1,6 +1,6 @@
<template>
<div>
<nav-bar />
<demo-nav />
<keep-alive>
<router-view />
</keep-alive>

View File

@ -16,7 +16,7 @@ export default {
</script>
<style lang="less">
@import '../style/variable';
@import '../../common/style/index';
.van-doc-demo-block {
&__title {

View File

@ -1421,11 +1421,6 @@
semver "^6.3.0"
tsutils "^3.17.1"
"@vant/doc@^2.6.1":
version "2.6.1"
resolved "https://registry.npm.taobao.org/@vant/doc/download/@vant/doc-2.6.1.tgz#667db2ca32cd86f3def452a03c66076c1b97c969"
integrity sha1-Zn2yyjLNhvPe9FKgPGYHbBuXyWk=
"@vant/eslint-config@^1.4.0":
version "1.4.0"
resolved "https://registry.npm.taobao.org/@vant/eslint-config/download/@vant/eslint-config-1.4.0.tgz#c9464beeea842a5ec64e5af714923a0cadf523b3"

View File

@ -1,15 +0,0 @@
# Vant Doc
UI components of Vant document site
#### NPM
```shell
npm i @vant/doc -D
```
#### YARN
```shell
yarn add @vant/doc --dev
```

View File

@ -1,13 +0,0 @@
const path = require('path');
const baseWebpackConfig = require('../../../build/webpack.pkg');
module.exports = Object.assign(baseWebpackConfig, {
entry: {
index: './src/index.js'
},
output: {
path: path.resolve(__dirname, '../lib'),
filename: '[name].js',
libraryTarget: 'commonjs2'
}
});

View File

@ -1,21 +0,0 @@
{
"name": "@vant/doc",
"version": "2.6.1",
"description": "vant document template",
"main": "./lib/index.js",
"publishConfig": {
"access": "public"
},
"files": [
"lib"
],
"scripts": {
"build": "webpack --progress --config ./build/webpack.config.js",
"release": "npm run build && npm publish"
},
"license": "MIT",
"repository": "https://github.com/youzan/vant/tree/dev/packages/vant-doc",
"devDependencies": {
"decamelize": "^3.2.0"
}
}

View File

@ -1,36 +0,0 @@
<template>
<section class="van-doc-demo-block">
<h2 class="van-doc-demo-block__title">{{ title }}</h2>
<slot />
</section>
</template>
<script>
export default {
name: 'demo-block',
props: {
title: String
}
};
</script>
<style lang="less">
@import '../style/variable';
.van-doc-demo-block {
&__title {
margin: 0;
padding: 32px 16px 16px;
color: @van-doc-text-light-blue;
font-weight: normal;
font-size: 14px;
}
&:first-of-type {
.van-doc-demo-block__title {
padding-top: 20px;
}
}
}
</style>

View File

@ -1,32 +0,0 @@
<template>
<section class="van-doc-demo-section" :class="demoName">
<slot />
</section>
</template>
<script>
import decamelize from 'decamelize';
export default {
name: 'demo-section',
computed: {
demoName() {
const { meta } = this.$route;
if (meta && meta.name) {
return `demo-${decamelize(meta.name, '-')}`;
}
return '';
}
}
};
</script>
<style lang="less">
.van-doc-demo-section {
box-sizing: border-box;
min-height: 100vh;
padding-bottom: 20px;
}
</style>

View File

@ -1,37 +0,0 @@
import Vue from 'vue';
import VanDoc from './VanDoc';
import Nav from './component/Nav';
import Header from './component/Header';
import Content from './component/Content';
import Container from './component/Container';
import Simulator from './component/Simulator';
import DemoBlock from './component/DemoBlock';
import DemoSection from './component/DemoSection';
const components = [
Nav,
Header,
VanDoc,
Content,
Container,
Simulator,
DemoBlock,
DemoSection
];
export default function install() {
components.forEach(Component => {
Vue.component(Component.name, Component);
});
}
export {
Nav,
Header,
VanDoc,
Content,
Container,
Simulator,
DemoBlock,
DemoSection
};

View File

@ -1,35 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/runtime-corejs2@^7.2.0":
version "7.7.2"
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs2/-/runtime-corejs2-7.7.2.tgz#5a8c4e2f8688ce58adc9eb1d8320b6e7341f96ce"
integrity sha512-GfVnHchOBvIMsweQ13l4jd9lT4brkevnavnVOej5g2y7PpTRY+R4pcQlCjWMZoUla5rMLFzaS/Ll2s59cB1TqQ==
dependencies:
core-js "^2.6.5"
regenerator-runtime "^0.13.2"
core-js@^2.6.5:
version "2.6.10"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.10.tgz#8a5b8391f8cc7013da703411ce5b585706300d7f"
integrity sha512-I39t74+4t+zau64EN1fE5v2W31Adtc/REhzWN+gWRRXg6WH5qAsZm62DHpQ1+Yhe4047T55jvzz7MUqF/dBBlA==
decamelize@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-3.2.0.tgz#84b8e8f4f8c579f938e35e2cc7024907e0090851"
integrity sha512-4TgkVUsmmu7oCSyGBm5FvfMoACuoh9EOidm7V5/J2X2djAwwt57qb3F2KMP2ITqODTCSwb+YRV+0Zqrv18k/hw==
dependencies:
xregexp "^4.2.4"
regenerator-runtime@^0.13.2:
version "0.13.3"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5"
integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==
xregexp@^4.2.4:
version "4.2.4"
resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.2.4.tgz#02a4aea056d65a42632c02f0233eab8e4d7e57ed"
integrity sha512-sO0bYdYeJAJBcJA8g7MJJX7UrOZIfJPd8U2SC7B2Dd/J24U0aQNoGp33shCaBSWeb0rD5rh6VBUIXOkGal1TZA==
dependencies:
"@babel/runtime-corejs2" "^7.2.0"