From 5288c3a4a16c567e1caba9cee0cef2448a92baec Mon Sep 17 00:00:00 2001 From: eiinu Date: Wed, 3 Jan 2024 19:29:04 +0800 Subject: [PATCH 1/3] chore(image): split demo --- src/packages/__VUE/image/demo/basic.vue | 6 ++++ src/packages/__VUE/image/demo/fit.vue | 12 +++++++ .../__VUE/image/{demo.vue => demo/index.vue} | 36 +++++++++---------- src/packages/__VUE/image/doc.en-US.md | 29 ++------------- src/packages/__VUE/image/doc.md | 29 ++------------- 5 files changed, 38 insertions(+), 74 deletions(-) create mode 100644 src/packages/__VUE/image/demo/basic.vue create mode 100644 src/packages/__VUE/image/demo/fit.vue rename src/packages/__VUE/image/{demo.vue => demo/index.vue} (82%) diff --git a/src/packages/__VUE/image/demo/basic.vue b/src/packages/__VUE/image/demo/basic.vue new file mode 100644 index 0000000000..0124b29c88 --- /dev/null +++ b/src/packages/__VUE/image/demo/basic.vue @@ -0,0 +1,6 @@ + + diff --git a/src/packages/__VUE/image/demo/fit.vue b/src/packages/__VUE/image/demo/fit.vue new file mode 100644 index 0000000000..341fae96f4 --- /dev/null +++ b/src/packages/__VUE/image/demo/fit.vue @@ -0,0 +1,12 @@ + + diff --git a/src/packages/__VUE/image/demo.vue b/src/packages/__VUE/image/demo/index.vue similarity index 82% rename from src/packages/__VUE/image/demo.vue rename to src/packages/__VUE/image/demo/index.vue index 524e892ff4..e36d0b54db 100644 --- a/src/packages/__VUE/image/demo.vue +++ b/src/packages/__VUE/image/demo/index.vue @@ -1,17 +1,12 @@ diff --git a/src/packages/__VUE/image/doc.en-US.md b/src/packages/__VUE/image/doc.en-US.md index eb5cca6926..93f7aba150 100644 --- a/src/packages/__VUE/image/doc.en-US.md +++ b/src/packages/__VUE/image/doc.en-US.md @@ -18,38 +18,13 @@ app.use(); The basic usage is the same as that of the native IMG tag. You can set the native attributes such as SRC, width, height, and Alt. -:::demo - -```vue - -``` - -::: +> demo: image basic ### Object Fill The `fit` attribute is used to set the image filling mode, which is equivalent to the original `Object-fit` attribute. -:::demo - -```vue - -``` - -::: +> demo: image fit ### Object Position diff --git a/src/packages/__VUE/image/doc.md b/src/packages/__VUE/image/doc.md index acf8ee8c58..d1751e4842 100644 --- a/src/packages/__VUE/image/doc.md +++ b/src/packages/__VUE/image/doc.md @@ -18,38 +18,13 @@ app.use(); 基础用法与原生 `img` 标签一致,可以设置 `src`、`width`、`height`、`alt` 等原生属性。 -:::demo - -```vue - -``` - -::: +> demo: image basic ### 填充模式 通过 `fit` 属性可以设置图片填充模式,等同于原生的 `object-fit` 属性,可选值见下方表格。 -:::demo - -```vue - -``` - -::: +> demo: image fit ### 图片位置 From 689500579b4aec0e2f17ea86cf6940d902938b70 Mon Sep 17 00:00:00 2001 From: eiinu Date: Thu, 4 Jan 2024 10:52:10 +0800 Subject: [PATCH 2/3] chore(image): split demo --- src/packages/__VUE/image/demo/basic.vue | 2 +- src/packages/__VUE/image/demo/error.vue | 16 +++ src/packages/__VUE/image/demo/fit.vue | 2 +- src/packages/__VUE/image/demo/index.vue | 117 +++------------------ src/packages/__VUE/image/demo/lazy.vue | 9 ++ src/packages/__VUE/image/demo/loading.vue | 13 +++ src/packages/__VUE/image/demo/position.vue | 19 ++++ src/packages/__VUE/image/demo/round.vue | 15 +++ src/packages/__VUE/image/doc.en-US.md | 93 +--------------- src/packages/__VUE/image/doc.md | 93 +--------------- 10 files changed, 100 insertions(+), 279 deletions(-) create mode 100644 src/packages/__VUE/image/demo/error.vue create mode 100644 src/packages/__VUE/image/demo/lazy.vue create mode 100644 src/packages/__VUE/image/demo/loading.vue create mode 100644 src/packages/__VUE/image/demo/position.vue create mode 100644 src/packages/__VUE/image/demo/round.vue diff --git a/src/packages/__VUE/image/demo/basic.vue b/src/packages/__VUE/image/demo/basic.vue index 0124b29c88..6fd0c6fe5c 100644 --- a/src/packages/__VUE/image/demo/basic.vue +++ b/src/packages/__VUE/image/demo/basic.vue @@ -2,5 +2,5 @@ diff --git a/src/packages/__VUE/image/demo/error.vue b/src/packages/__VUE/image/demo/error.vue new file mode 100644 index 0000000000..ef68ea928c --- /dev/null +++ b/src/packages/__VUE/image/demo/error.vue @@ -0,0 +1,16 @@ + + diff --git a/src/packages/__VUE/image/demo/fit.vue b/src/packages/__VUE/image/demo/fit.vue index 341fae96f4..6dd902d11d 100644 --- a/src/packages/__VUE/image/demo/fit.vue +++ b/src/packages/__VUE/image/demo/fit.vue @@ -7,6 +7,6 @@ diff --git a/src/packages/__VUE/image/demo/index.vue b/src/packages/__VUE/image/demo/index.vue index e36d0b54db..df99084822 100644 --- a/src/packages/__VUE/image/demo/index.vue +++ b/src/packages/__VUE/image/demo/index.vue @@ -3,138 +3,53 @@

{{ t('basic') }}

-

{{ t('fill') }}

+

{{ t('fit') }}

{{ t('position') }}

- - - -
contain
-
{{ pos }}
-
+ - - -
cover
-
{{ pos }}
-
-
- -

{{ t('circle') }}

- - - -
contain
-
- - -
cover
-
- - -
cover
-
-
+

{{ t('round') }}

+

{{ t('loading') }}

- - - - -
默认
-
- - - - -
自定义
-
-
-
+

{{ t('error') }}

- - - - -
默认
-
- - - - -
自定义
-
-
-
+

{{ t('lazy') }}

- - - - - - - - - - - - - - - + - diff --git a/src/packages/__VUE/image/demo/lazy.vue b/src/packages/__VUE/image/demo/lazy.vue new file mode 100644 index 0000000000..e1ba53bfc2 --- /dev/null +++ b/src/packages/__VUE/image/demo/lazy.vue @@ -0,0 +1,9 @@ + + diff --git a/src/packages/__VUE/image/demo/loading.vue b/src/packages/__VUE/image/demo/loading.vue new file mode 100644 index 0000000000..f373ef253f --- /dev/null +++ b/src/packages/__VUE/image/demo/loading.vue @@ -0,0 +1,13 @@ + + diff --git a/src/packages/__VUE/image/demo/position.vue b/src/packages/__VUE/image/demo/position.vue new file mode 100644 index 0000000000..a63a866192 --- /dev/null +++ b/src/packages/__VUE/image/demo/position.vue @@ -0,0 +1,19 @@ + + diff --git a/src/packages/__VUE/image/demo/round.vue b/src/packages/__VUE/image/demo/round.vue new file mode 100644 index 0000000000..ae2887841f --- /dev/null +++ b/src/packages/__VUE/image/demo/round.vue @@ -0,0 +1,15 @@ + + diff --git a/src/packages/__VUE/image/doc.en-US.md b/src/packages/__VUE/image/doc.en-US.md index 93f7aba150..afab3af216 100644 --- a/src/packages/__VUE/image/doc.en-US.md +++ b/src/packages/__VUE/image/doc.en-US.md @@ -30,112 +30,29 @@ The `fit` attribute is used to set the image filling mode, which is equivalent t The position property can be used to set the position of the picture, which is equivalent to the original `Object-position` property when combined with the FIT property. -:::demo - -```vue - -``` - -::: +> demo: image position ### Round The round attribute allows you to set the image to be round. Note that if the image is not contained and fit is contained or scale-down, a full circle cannot be contained. -:::demo - -```vue - -``` - -::: +> demo: image round ### Loading The Image component provides a default `loading` prompt and supports custom content through the loading slot. -:::demo - -```vue - - -``` - -::: +> demo: image loading ### Error The Image component provides a default loading failure warning and supports custom content through the `error` slot. -:::demo - -```vue - - -``` - -::: +> demo: image error ### LazyLoad -:::demo - -```vue - - -``` - -::: +> demo: image lazy ## API diff --git a/src/packages/__VUE/image/doc.md b/src/packages/__VUE/image/doc.md index d1751e4842..706b6d74fe 100644 --- a/src/packages/__VUE/image/doc.md +++ b/src/packages/__VUE/image/doc.md @@ -30,114 +30,31 @@ app.use(); 通过 `position` 属性可以设置图片位置,结合 `fit` 属性使用,等同于原生的 `object-position` 属性。 -:::demo - -```vue - -``` - -::: +> demo: image position ### 圆形图片 通过 `round` 属性可以设置图片变圆,注意当图片宽高不相等且 `fit` 为 `contain` 或 `scale-down` 时,将无法填充一个完整的圆形。 -:::demo - -```vue - -``` - -::: +> demo: image round ### 加载中图片 Image 组件提供了默认的加载中提示,支持通过 `loading` 插槽自定义内容。 -:::demo - -```vue - - -``` - -::: +> demo: image loading ### 加载失败 Image 组件提供了默认的加载失败提示,支持通过 `error` 插槽自定义内容。 -:::demo - -```vue - - -``` - -::: +> demo: image error ### 懒加载 刷新后滚动 Demo 页面,在控制台中查看图片请求时间。 -:::demo - -```vue - - -``` - -::: +> demo: image lazy ## API From bd0d38b20ba032ba5f0dd53e495107ee68534ba8 Mon Sep 17 00:00:00 2001 From: eiinu Date: Thu, 4 Jan 2024 11:00:17 +0800 Subject: [PATCH 3/3] fix: allow js --- src/packages/__VUE/image/demo/position.vue | 2 +- tsconfig.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/packages/__VUE/image/demo/position.vue b/src/packages/__VUE/image/demo/position.vue index a63a866192..1b8ed4771e 100644 --- a/src/packages/__VUE/image/demo/position.vue +++ b/src/packages/__VUE/image/demo/position.vue @@ -12,7 +12,7 @@ -