chore(cli): update eslint config and prettier codes

This commit is contained in:
陈嘉涵
2020-01-19 11:42:22 +08:00
parent 633e9cf59d
commit 1691451813
52 changed files with 383 additions and 363 deletions
@@ -12,8 +12,8 @@ export default {
name: 'van-doc-container',
props: {
hasSimulator: Boolean
}
hasSimulator: Boolean,
},
};
</script>
@@ -15,8 +15,8 @@ export default {
return path.split('/').slice(-1)[0];
}
return this.$route.name;
}
}
},
},
};
</script>
@@ -3,21 +3,36 @@
<div class="van-doc-row">
<div class="van-doc-header__top">
<a class="van-doc-header__logo">
<img :src="config.logo">
<img :src="config.logo" />
<span>{{ config.title }}</span>
</a>
<search-input v-if="searchConfig" :lang="lang" :search-config="searchConfig" />
<search-input
v-if="searchConfig"
:lang="lang"
:search-config="searchConfig"
/>
<ul class="van-doc-header__top-nav">
<li v-for="item in config.links" class="van-doc-header__top-nav-item">
<a class="van-doc-header__logo-link" target="_blank" :href="item.url">
<img :src="item.logo">
<a
class="van-doc-header__logo-link"
target="_blank"
:href="item.url"
>
<img :src="item.logo" />
</a>
</li>
<li ref="version" v-if="versions" class="van-doc-header__top-nav-item">
<span class="van-doc-header__cube van-doc-header__version" @click="toggleVersionPop">
<li
ref="version"
v-if="versions"
class="van-doc-header__top-nav-item"
>
<span
class="van-doc-header__cube van-doc-header__version"
@click="toggleVersionPop"
>
{{ versions[0].label }}
<transition name="van-doc-dropdown">
<div v-if="showVersionPop" class="van-doc-header__version-pop">
@@ -49,19 +64,19 @@ export default {
name: 'van-doc-header',
components: {
SearchInput
SearchInput,
},
props: {
lang: String,
config: Object,
versions: Array,
langConfigs: Array
langConfigs: Array,
},
data() {
return {
showVersionPop: false
showVersionPop: false,
};
},
@@ -85,7 +100,7 @@ export default {
searchConfig() {
return this.config.searchConfig;
}
},
},
methods: {
@@ -93,7 +108,10 @@ export default {
const val = !this.showVersionPop;
const action = val ? 'add' : 'remove';
document.body[`${action}EventListener`]('click', this.checkHideVersionPop);
document.body[`${action}EventListener`](
'click',
this.checkHideVersionPop
);
this.showVersionPop = val;
},
@@ -110,8 +128,8 @@ export default {
onSwitchVersion(version) {
location.href = version.link;
}
}
},
},
};
</script>
@@ -28,18 +28,18 @@ export default {
name: 'van-doc-nav',
components: {
[NavLink.name]: NavLink
[NavLink.name]: NavLink,
},
props: {
lang: String,
navConfig: Array
navConfig: Array,
},
data() {
return {
top: 60,
bottom: 0
bottom: 0,
};
},
@@ -47,13 +47,13 @@ export default {
style() {
return {
top: this.top + 'px',
bottom: this.bottom + 'px'
bottom: this.bottom + 'px',
};
},
base() {
return this.lang ? `/${this.lang}/` : '/';
}
},
},
created() {
@@ -65,8 +65,8 @@ export default {
onScroll() {
const { pageYOffset: offset } = window;
this.top = Math.max(0, 60 - offset);
}
}
},
},
};
</script>
@@ -1,7 +1,12 @@
<template>
<router-link v-if="item.path" :class="{ active }" :to="path" v-html="itemName" />
<router-link
v-if="item.path"
:class="{ active }"
:to="path"
v-html="itemName"
/>
<a v-else-if="item.link" :href="item.link" v-html="itemName" />
<a v-else v-html="itemName " />
<a v-else v-html="itemName" />
</template>
<script>
@@ -10,7 +15,7 @@ export default {
props: {
base: String,
item: Object
item: Object,
},
computed: {
@@ -33,13 +38,13 @@ export default {
}
return false;
}
},
},
watch: {
active() {
this.scrollIntoView();
}
},
},
mounted() {
@@ -51,7 +56,7 @@ export default {
if (this.active && this.$el && this.$el.scrollIntoViewIfNeeded) {
this.$el.scrollIntoViewIfNeeded();
}
}
}
},
},
};
</script>
@@ -1,5 +1,5 @@
<template>
<input class="van-doc-search" :placeholder="placeholder">
<input class="van-doc-search" :placeholder="placeholder" />
</template>
<script>
@@ -8,13 +8,13 @@ export default {
props: {
lang: String,
searchConfig: Object
searchConfig: Object,
},
computed: {
placeholder() {
return this.searchConfig.placeholder || 'Search...';
}
},
},
watch: {
@@ -22,7 +22,7 @@ export default {
if (this.docsearchInstance) {
this.docsearchInstance.algoliaOptions.facetFilters = [`lang:${lang}`];
}
}
},
},
mounted() {
@@ -31,11 +31,11 @@ export default {
...this.searchConfig,
inputSelector: '.van-doc-search',
algoliaOptions: {
facetFilters: [`lang:${this.lang}`]
}
facetFilters: [`lang:${this.lang}`],
},
});
}
}
},
};
</script>
@@ -9,13 +9,13 @@ export default {
name: 'van-doc-simulator',
props: {
src: String
src: String,
},
data() {
return {
scrollTop: window.scrollY,
windowHeight: window.innerHeight
windowHeight: window.innerHeight,
};
},
@@ -27,9 +27,9 @@ export default {
simulatorStyle() {
const height = Math.min(640, this.windowHeight - 90);
return {
height: height + 'px'
height: height + 'px',
};
}
},
},
mounted() {
@@ -39,7 +39,7 @@ export default {
window.addEventListener('resize', () => {
this.windowHeight = window.innerHeight;
});
}
},
};
</script>
@@ -8,7 +8,7 @@
@switch-version="$emit('switch-version', $event)"
/>
<doc-nav :lang="lang" :nav-config="config.nav" />
<doc-container :has-simulator="!!simulator ">
<doc-container :has-simulator="!!simulator">
<doc-content>
<slot />
</doc-content>
@@ -32,7 +32,7 @@ export default {
DocHeader,
DocContent,
DocContainer,
DocSimulator
DocSimulator,
},
props: {
@@ -42,19 +42,19 @@ export default {
langConfigs: Array,
config: {
type: Object,
required: true
required: true,
},
base: {
type: String,
default: ''
}
default: '',
},
},
watch: {
// eslint-disable-next-line
'$route.path'() {
this.setNav();
}
},
},
created() {
@@ -98,8 +98,8 @@ export default {
break;
}
});
}
}
},
},
};
</script>