From 143bd4297f0115ed964565cba493da3a6b48f8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 3 Feb 2020 11:56:57 +0800 Subject: [PATCH] docs(Field): split demo --- docs/site/mobile.js | 6 + src/field/demo/Autosize.vue | 37 +++ src/field/demo/BasicUsage.vue | 26 ++ src/field/demo/CustomType.vue | 76 +++++ src/field/demo/Disabled.vue | 26 ++ src/field/demo/ErrorInfo.vue | 46 +++ src/field/demo/FormatValue.vue | 39 +++ src/field/demo/InputAlign.vue | 35 +++ src/field/demo/InsertButton.vue | 44 +++ src/field/demo/ShowIcon.vue | 44 +++ src/field/demo/ShowWordLimit.vue | 39 +++ src/field/demo/index.vue | 283 ++---------------- .../test/__snapshots__/demo.spec.js.snap | 4 +- 13 files changed, 452 insertions(+), 253 deletions(-) create mode 100644 src/field/demo/Autosize.vue create mode 100644 src/field/demo/BasicUsage.vue create mode 100644 src/field/demo/CustomType.vue create mode 100644 src/field/demo/Disabled.vue create mode 100644 src/field/demo/ErrorInfo.vue create mode 100644 src/field/demo/FormatValue.vue create mode 100644 src/field/demo/InputAlign.vue create mode 100644 src/field/demo/InsertButton.vue create mode 100644 src/field/demo/ShowIcon.vue create mode 100644 src/field/demo/ShowWordLimit.vue diff --git a/docs/site/mobile.js b/docs/site/mobile.js index 166e36204..b2dc843a9 100644 --- a/docs/site/mobile.js +++ b/docs/site/mobile.js @@ -16,6 +16,8 @@ Locale.add({ // flag for vant-weapp demos const isWeapp = location.search.indexOf('weapp=1') !== -1; +let demoUid = 0; + // helper for demo locales Vue.mixin({ computed: { @@ -37,6 +39,10 @@ Vue.mixin({ }, beforeCreate() { + if (!this.$options.name) { + this.$options.name = `demo-${demoUid++}`; + } + const { i18n, name } = this.$options; if (i18n && name) { diff --git a/src/field/demo/Autosize.vue b/src/field/demo/Autosize.vue new file mode 100644 index 000000000..8744064f8 --- /dev/null +++ b/src/field/demo/Autosize.vue @@ -0,0 +1,37 @@ + + + diff --git a/src/field/demo/BasicUsage.vue b/src/field/demo/BasicUsage.vue new file mode 100644 index 000000000..5e436f949 --- /dev/null +++ b/src/field/demo/BasicUsage.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/field/demo/CustomType.vue b/src/field/demo/CustomType.vue new file mode 100644 index 000000000..523059a60 --- /dev/null +++ b/src/field/demo/CustomType.vue @@ -0,0 +1,76 @@ + + + diff --git a/src/field/demo/Disabled.vue b/src/field/demo/Disabled.vue new file mode 100644 index 000000000..48e52298a --- /dev/null +++ b/src/field/demo/Disabled.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/field/demo/ErrorInfo.vue b/src/field/demo/ErrorInfo.vue new file mode 100644 index 000000000..169ba7fd8 --- /dev/null +++ b/src/field/demo/ErrorInfo.vue @@ -0,0 +1,46 @@ + + + diff --git a/src/field/demo/FormatValue.vue b/src/field/demo/FormatValue.vue new file mode 100644 index 000000000..ef149f913 --- /dev/null +++ b/src/field/demo/FormatValue.vue @@ -0,0 +1,39 @@ + + + diff --git a/src/field/demo/InputAlign.vue b/src/field/demo/InputAlign.vue new file mode 100644 index 000000000..df0cc0191 --- /dev/null +++ b/src/field/demo/InputAlign.vue @@ -0,0 +1,35 @@ + + + diff --git a/src/field/demo/InsertButton.vue b/src/field/demo/InsertButton.vue new file mode 100644 index 000000000..c9f95058b --- /dev/null +++ b/src/field/demo/InsertButton.vue @@ -0,0 +1,44 @@ + + + diff --git a/src/field/demo/ShowIcon.vue b/src/field/demo/ShowIcon.vue new file mode 100644 index 000000000..ea42fa861 --- /dev/null +++ b/src/field/demo/ShowIcon.vue @@ -0,0 +1,44 @@ + + + diff --git a/src/field/demo/ShowWordLimit.vue b/src/field/demo/ShowWordLimit.vue new file mode 100644 index 000000000..7f73fd46f --- /dev/null +++ b/src/field/demo/ShowWordLimit.vue @@ -0,0 +1,39 @@ + + + diff --git a/src/field/demo/index.vue b/src/field/demo/index.vue index c89420f6d..2ba3649dd 100644 --- a/src/field/demo/index.vue +++ b/src/field/demo/index.vue @@ -1,261 +1,42 @@ - - diff --git a/src/field/test/__snapshots__/demo.spec.js.snap b/src/field/test/__snapshots__/demo.spec.js.snap index 45f50bb82..35ee97271 100644 --- a/src/field/test/__snapshots__/demo.spec.js.snap +++ b/src/field/test/__snapshots__/demo.spec.js.snap @@ -108,8 +108,8 @@ exports[`renders demo correctly 1`] = `
+ 发送验证码 +