docs: add size demo for Dialog; sort component list by alphabetic order (#3)

This commit is contained in:
Kyle He 2020-12-03 10:30:05 +08:00 committed by GitHub
parent c93403bb83
commit facb9c8190
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 87 additions and 2 deletions

View File

@ -1,5 +1,5 @@
import { compact, find } from 'lodash' import { compact, find } from 'lodash'
import nav from '../assets/data/nav.json' import nav from './nav'
export const LOCALES = [ export const LOCALES = [
{ {

15
common/nav.js Normal file
View File

@ -0,0 +1,15 @@
import { entries, sortBy } from 'lodash'
import nav from '../assets/data/nav.json'
export default entries(nav).reduce(function (ret, [lang, items]) {
ret[lang] = items.map(function (item) {
if (!item.children) {
return item
}
return {
...item,
children: sortBy(item.children, child => child.title)
}
})
return ret
}, {})

View File

@ -23,7 +23,7 @@ import OneHeader from '../components/OneHeader'
import OneMenu from '../components/OneMenu' import OneMenu from '../components/OneMenu'
import OneFooter from '../components/OneFooter' import OneFooter from '../components/OneFooter'
import OneBackToTop from '../components/OneBackToTop' import OneBackToTop from '../components/OneBackToTop'
import nav from '../assets/data/nav.json' import nav from '../common/nav'
import i18n from '../common/i18n' import i18n from '../common/i18n'
import i18nMgr from 'veui/managers/i18n' import i18nMgr from 'veui/managers/i18n'

View File

@ -2,6 +2,10 @@
## 示例 ## 示例
### 尺寸与全屏
[[ demo src="/demo/dialog/size.vue" ]]
### 模态与非模态 ### 模态与非模态
[[ demo src="/demo/dialog/modal.vue" ]] [[ demo src="/demo/dialog/modal.vue" ]]

View File

@ -0,0 +1,66 @@
<template>
<article>
<veui-button @click="openDialog('s')">
s
</veui-button>
<veui-button @click="openDialog('m')">
m
</veui-button>
<veui-button @click="openDialog('narrow')">
narrow
</veui-button>
<veui-button @click="openDialog('medium')">
medium
</veui-button>
<veui-button @click="openDialog('wide')">
wide
</veui-button>
<veui-button @click="openDialog('fullscreen')">
fullscreen
</veui-button>
<veui-button @click="openDialog('auto')">
auto
</veui-button>
<veui-dialog
title="System"
:ui="ui"
:open.sync="open"
>
<p>Current UI: "{{ ui }}"</p>
<p v-if="ui === 's' || ui === 'm'">
<veui-button>Button size: {{ ui }}</veui-button>
<veui-switch>{{ ui }}</veui-switch>
</p>
</veui-dialog>
</article>
</template>
<script>
import { Dialog, Button, Switch } from 'veui'
export default {
components: {
'veui-dialog': Dialog,
'veui-button': Button,
'veui-switch': Switch
},
data () {
return {
open: false,
ui: null
}
},
methods: {
openDialog (size) {
this.ui = size
this.open = true
}
}
}
</script>
<style lang="less" scoped docs>
.veui-button {
margin-right: 20px;
}
</style>