docs: simplify seciton name (#4961)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vant/doc",
|
||||
"version": "2.5.7",
|
||||
"version": "2.6.1",
|
||||
"description": "vant document template",
|
||||
"main": "./lib/index.js",
|
||||
"publishConfig": {
|
||||
@@ -14,5 +14,8 @@
|
||||
"release": "npm run build && npm publish"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/youzan/vant/tree/dev/packages/vant-doc"
|
||||
"repository": "https://github.com/youzan/vant/tree/dev/packages/vant-doc",
|
||||
"devDependencies": {
|
||||
"decamelize": "^3.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<template>
|
||||
<div class="van-doc-block">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'van-doc-block'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import '../style/variable';
|
||||
|
||||
.van-doc-block {
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.highlight {
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
|
||||
pre {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'van-doc-demo-block',
|
||||
name: 'demo-block',
|
||||
|
||||
props: {
|
||||
title: String
|
||||
|
||||
@@ -1,62 +1,32 @@
|
||||
<template>
|
||||
<section class="van-doc-demo-section" :class="`demo-${demoName}`" :style="style">
|
||||
<section class="van-doc-demo-section" :class="demoName">
|
||||
<slot />
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'van-doc-demo-section',
|
||||
import decamelize from 'decamelize';
|
||||
|
||||
props: {
|
||||
name: String,
|
||||
title: String,
|
||||
background: String
|
||||
},
|
||||
export default {
|
||||
name: 'demo-section',
|
||||
|
||||
computed: {
|
||||
demoName() {
|
||||
return this.name || this.getParentName();
|
||||
},
|
||||
style() {
|
||||
return {
|
||||
background: this.background
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getParentName() {
|
||||
const { $parent } = this;
|
||||
if ($parent && $parent.$options.name) {
|
||||
return $parent.$options.name.replace('demo-', '');
|
||||
const { meta } = this.$route;
|
||||
if (meta && meta.name) {
|
||||
return `demo-${decamelize(meta.name, '-')}`;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import '../style/variable';
|
||||
|
||||
.van-doc-demo-section {
|
||||
box-sizing: border-box;
|
||||
min-height: 100vh;
|
||||
padding-bottom: 20px;
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
text-transform: capitalize;
|
||||
|
||||
+ .van-doc-demo-block {
|
||||
.van-doc-demo-block__title {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
import VanDoc from './VanDoc';
|
||||
import Nav from './component/Nav';
|
||||
import Block from './component/Block';
|
||||
import Header from './component/Header';
|
||||
import Content from './component/Content';
|
||||
import Container from './component/Container';
|
||||
@@ -13,7 +12,6 @@ const components = [
|
||||
Nav,
|
||||
Header,
|
||||
VanDoc,
|
||||
Block,
|
||||
Content,
|
||||
Container,
|
||||
Simulator,
|
||||
@@ -31,7 +29,6 @@ export {
|
||||
Nav,
|
||||
Header,
|
||||
VanDoc,
|
||||
Block,
|
||||
Content,
|
||||
Container,
|
||||
Simulator,
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# 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"
|
||||
Reference in New Issue
Block a user