mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
epic(website): refactor website (#3426)
* feat(website): init viteperss (#3162) * init vitepress * Finish homepage * relayout page * partial finish * update * update use lang * remove font weight; change font size * docs: optimize docs folder structure * reorganize project * fix ssr issue * fix build issues Co-authored-by: Kevin <sxzz@sxzz.moe> Co-authored-by: zouhang <zouhang@didiglobal.com> * feat(website) integrate with crowdin (#3218) - Introduce Crowdin CLI - Add script for fetching Crowdin token from env - Add script for local development * fix formatting * update codeblocks (#3249) * feat(docs): update website preview script - Update azure preview build script - Eliminate dead links * bootstrap docs * fix homepage layout issue * fix formating * Finish ToC and codepen integration * reorganized files and fix issue that causes demo unavailable after build * feat(docs): migration documentations (#3283) * feat(docs): migration documentations - Move documentations to docs/ * remove unused files * docs: [popconfirm] migrate document (#3285) * feat(docs): migrate documentation from space.md to upload.md (#3292) - Upload documentations acorrodingly * docs: [date-picker] migrate document (#3289) * docs: [date-picker] migrate document * fix: typo * docs: [slider] migrate document (#3287) * docs: migrate documents (#3290) * docs: migrate-datetime-picker * docs: migrate descriptions * docs: migrate dialog * docs: migrate divider * docs: migrate drawer * docs: migrate drapdown * docs: fix drapdown * docs: migrate empty * docs: migrate form * docs: add scoped for style * docs: simplify toRefs * chore: update doc (#3297) * chore: update doc * chore: update doc * chore: update doc * feat(docs): migrate documentations from infinite-scroll to page-header (#3303) - Update docs accordingly - Update CodePen icon to match style - Update component name to match others * docs: migrate documentions (#3293) migrate list: * image * popover * scrollbar * radio * rate * skeleton * select * select-v2 * reault * progress * pagination * chore: update doc (#3305) Co-authored-by: 0song <0song@gmail.com> * Fix broken pipeline * chore: update demo plugin * website perfection * fix hydration bug * docs: update guide (#3342) * WIP docs * docs: update docs * add dark mode * make dev fetch components from local instead of node_modules Co-authored-by: msidolphin <msidolphin@outlook.com> Co-authored-by: Aex <spryti@qq.com> Co-authored-by: 0song <82012629+0song@users.noreply.github.com> Co-authored-by: 0song <0song@gmail.com> Co-authored-by: zouhang <zouhang@didiglobal.com> Co-authored-by: 三咲智子 <sxzz@sxzz.moe> * fix(docs): fix codepen code example issue (#3380) * fix(docs): fix codepen code example issue - Add lang="ts" for all example files - Fix codepen import error * revert changes in resource.vue * feat(docs): complete crowdin integration (#3408) * Update mds for preparing the integration script * deprecate old website * update sponsors and even handler for resize * update build script for preview * fix preview-build error * fix preview-build error * fix preview-build error * fix preview-build error * fix preview-build error * update deploy script and some bugs * Fix existing issue * chore(project): add dev preview workflow * chore(project): rename dev to staging * update the size of toc * update staging-preview script * update preview scripts * enable website build for preview * fix build error * final commitment for update the details * remove azure pipeline * move docs ignores into docs and update date Co-authored-by: Kevin <sxzz@sxzz.moe> Co-authored-by: zouhang <zouhang@didiglobal.com> Co-authored-by: msidolphin <msidolphin@outlook.com> Co-authored-by: Aex <spryti@qq.com> Co-authored-by: 0song <82012629+0song@users.noreply.github.com> Co-authored-by: 0song <0song@gmail.com>
This commit is contained in:
47
docs/examples/drawer/basic-usage.vue
Normal file
47
docs/examples/drawer/basic-usage.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<el-radio-group v-model="direction">
|
||||
<el-radio label="ltr">left to right</el-radio>
|
||||
<el-radio label="rtl">right to left</el-radio>
|
||||
<el-radio label="ttb">top to bottom</el-radio>
|
||||
<el-radio label="btt">bottom to top</el-radio>
|
||||
</el-radio-group>
|
||||
|
||||
<el-button type="primary" style="margin-left: 16px" @click="drawer = true">
|
||||
open
|
||||
</el-button>
|
||||
|
||||
<el-drawer
|
||||
v-model="drawer"
|
||||
title="I am the title"
|
||||
:direction="direction"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<span>Hi, there!</span>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const drawer = ref(false)
|
||||
const direction = ref('rtl')
|
||||
const handleClose = (done) => {
|
||||
ElMessageBox.confirm('Are you sure you want to close this?')
|
||||
.then(() => {
|
||||
done()
|
||||
})
|
||||
.catch(() => {
|
||||
// catch error
|
||||
})
|
||||
}
|
||||
return {
|
||||
drawer,
|
||||
direction,
|
||||
handleClose,
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
144
docs/examples/drawer/customization-content.vue
Normal file
144
docs/examples/drawer/customization-content.vue
Normal file
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<el-button type="text" @click="table = true"
|
||||
>Open Drawer with nested table</el-button
|
||||
>
|
||||
<el-button type="text" @click="dialog = true"
|
||||
>Open Drawer with nested form</el-button
|
||||
>
|
||||
<el-drawer
|
||||
v-model="table"
|
||||
title="I have a nested table inside!"
|
||||
direction="rtl"
|
||||
size="50%"
|
||||
>
|
||||
<el-table :data="gridData">
|
||||
<el-table-column
|
||||
property="date"
|
||||
label="Date"
|
||||
width="150"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
property="name"
|
||||
label="Name"
|
||||
width="200"
|
||||
></el-table-column>
|
||||
<el-table-column property="address" label="Address"></el-table-column>
|
||||
</el-table>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer
|
||||
ref="drawer"
|
||||
v-model="dialog"
|
||||
title="I have a nested form inside!"
|
||||
:before-close="handleClose"
|
||||
direction="ltr"
|
||||
custom-class="demo-drawer"
|
||||
>
|
||||
<div class="demo-drawer__content">
|
||||
<el-form :model="form">
|
||||
<el-form-item label="Name" :label-width="formLabelWidth">
|
||||
<el-input v-model="form.name" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Area" :label-width="formLabelWidth">
|
||||
<el-select
|
||||
v-model="form.region"
|
||||
placeholder="Please select activity area"
|
||||
>
|
||||
<el-option label="Area1" value="shanghai"></el-option>
|
||||
<el-option label="Area2" value="beijing"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="demo-drawer__footer">
|
||||
<el-button @click="cancelForm">Cancel</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
@click="$refs.drawer.closeDrawer()"
|
||||
>{{ loading ? 'Submitting ...' : 'Submit' }}</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive, toRefs } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const state = reactive({
|
||||
table: false,
|
||||
dialog: false,
|
||||
loading: false,
|
||||
gridData: [
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: 'Peter Parker',
|
||||
address: 'Queens, New York City',
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: 'Peter Parker',
|
||||
address: 'Queens, New York City',
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: 'Peter Parker',
|
||||
address: 'Queens, New York City',
|
||||
},
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: 'Peter Parker',
|
||||
address: 'Queens, New York City',
|
||||
},
|
||||
],
|
||||
form: {
|
||||
name: '',
|
||||
region: '',
|
||||
date1: '',
|
||||
date2: '',
|
||||
delivery: false,
|
||||
type: [],
|
||||
resource: '',
|
||||
desc: '',
|
||||
},
|
||||
formLabelWidth: '80px',
|
||||
timer: null,
|
||||
})
|
||||
|
||||
const handleClose = (done) => {
|
||||
if (state.loading) {
|
||||
return
|
||||
}
|
||||
ElMessageBox.confirm('Do you want to submit?')
|
||||
.then(() => {
|
||||
state.loading = true
|
||||
state.timer = setTimeout(() => {
|
||||
done()
|
||||
// 动画关闭需要一定的时间
|
||||
setTimeout(() => {
|
||||
state.loading = false
|
||||
}, 400)
|
||||
}, 2000)
|
||||
})
|
||||
.catch(() => {
|
||||
// catch error
|
||||
})
|
||||
}
|
||||
|
||||
const cancelForm = () => {
|
||||
state.loading = false
|
||||
state.dialog = false
|
||||
clearTimeout(state.timer)
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
handleClose,
|
||||
cancelForm,
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
45
docs/examples/drawer/nested-drawer.vue
Normal file
45
docs/examples/drawer/nested-drawer.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<el-button type="primary" style="margin-left: 16px" @click="drawer = true">
|
||||
open
|
||||
</el-button>
|
||||
|
||||
<el-drawer v-model="drawer" title="I'm outer Drawer" size="50%">
|
||||
<div>
|
||||
<el-button @click="innerDrawer = true">Click me!</el-button>
|
||||
<el-drawer
|
||||
v-model="innerDrawer"
|
||||
title="I'm inner Drawer"
|
||||
:append-to-body="true"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<p>_(:зゝ∠)_</p>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const drawer = ref(false)
|
||||
const innerDrawer = ref(false)
|
||||
const handleClose = (done) => {
|
||||
ElMessageBox.confirm('You still have unsaved data, proceed?')
|
||||
.then(() => {
|
||||
done()
|
||||
})
|
||||
.catch(() => {
|
||||
// catch error
|
||||
})
|
||||
}
|
||||
return {
|
||||
drawer,
|
||||
innerDrawer,
|
||||
handleClose,
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
21
docs/examples/drawer/no-title.vue
Normal file
21
docs/examples/drawer/no-title.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<el-button type="primary" style="margin-left: 16px" @click="drawer = true">
|
||||
open
|
||||
</el-button>
|
||||
|
||||
<el-drawer v-model="drawer" title="I am the title" :with-header="false">
|
||||
<span>Hi there!</span>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
return {
|
||||
drawer: ref(false),
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user