Skip to content

Commit 02213bd

Browse files
committed
feat: 新增配置项
1 parent 3f15735 commit 02213bd

File tree

8 files changed

+59
-38
lines changed

8 files changed

+59
-38
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
**fix**
66

77
- 修复 `FImage` 组件旋转方向一致的问题
8+
- 修复 `FIcon` 组件预览窗操作点击失效问题,处理点击焦点位置
89
- 修复 `FIcon``FButton` 组件的类型问题
910
- `FImage` 组件的 `select` 属性改为 `no-select` 用于禁止选择
1011

@@ -17,6 +18,7 @@
1718
- 新增 `FImage` 组件预览图左右按钮切换加入图片长度识别,是否展示效果
1819
- 新增 `FImage` 组件 `show-close-btn` 配置项可配置是否展示预览窗的关闭按钮
1920
- 新增 `FImage` 组件可通过鼠标滚轮放大缩小图片功能
21+
- 新增 `FImage` 组件 `preview-round` 配置项,可配置预览图的圆角
2022

2123
## 0.0.5 beta.5 (2022-05-27)
2224

docs/docs/components/image.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,17 @@
190190
| fit | 如何适应容器,原生 [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit#try_it) 属性 | string | `fill` `contain` `cover` `none` `scale-down` | —— |
191191
| no-select | 是否禁止选择 | boolean | —— | false |
192192
| referrer-policy | 原生 [referrerPolicy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy#syntax) 属性 | string | —— | —— |
193-
| preview-list | 开启图片预览 | string[] | —— | [] |
194-
| preview-show-index | 图片预览展示的首张图的索引,从 0 开始 | number | —— | 0 |
195-
| preview-z-index | 图片预览展示的 [z-index](https://developer.mozilla.org/zh-CN/docs/Web/CSS/z-index) | number | —— | 999 |
196-
| preview-show-option | 是否展示图片预览下面的操作栏 | boolean | —— | true |
197193
| round | 配置圆角,传入一个单位 | string | —— | —— |
198194
| err-src | 加载失败时要显示的地址 | string | —— | —— |
199195
| caption | 图片上的说明文字 | string | —— | —— |
200196
| caption-color | 图片上的说明文字的颜色 | string | —— | #fff |
201197
| modal-close | 是否点击遮罩层关闭预览窗 | boolean | —— | true |
202198
| show-close-btn | 是否展示预览窗口的关闭按钮 | boolean | —— | true |
199+
| preview-list | 开启图片预览 | string[] | —— | [] |
200+
| preview-show-index | 图片预览展示的首张图的索引,从 0 开始 | number | —— | 0 |
201+
| preview-z-index | 图片预览展示的 [z-index](https://developer.mozilla.org/zh-CN/docs/Web/CSS/z-index) | number | —— | 999 |
202+
| preview-show-option | 是否展示图片预览下面的操作栏 | boolean | —— | true |
203+
| preview-round | 预览图的圆角 ,传入一个单位 | string | —— | —— |
203204

204205
## Events
205206

packages/fighting-components/image/src/PreviewList.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { PropType } from 'vue'
22

33
export const Props = {
44
previewList: {
5-
type: Array as PropType<string[]>,
5+
type: Array as PropType<Array<string>>,
66
default: (): [] => []
77
},
88
previewShowIndex: {
@@ -24,6 +24,10 @@ export const Props = {
2424
showCloseBtn: {
2525
type: Boolean,
2626
default: (): boolean => true
27+
},
28+
previewRound: {
29+
type: String,
30+
default: (): string => ''
2731
}
2832
} as const
2933

packages/fighting-components/image/src/PreviewList.vue

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,30 @@
1010
class="f-image-showImg"
1111
draggable="false"
1212
:src="previewList[previewShowIndex]"
13-
:style="{ transform: `scale(${scale}) rotate(${rotate}deg)` }"
13+
:style="{
14+
transform: `scale(${scale}) rotate(${rotate}deg)`,
15+
borderRadius: previewRound
16+
}"
1417
/>
1518

16-
<div v-if="previewList.length > 1" class="right_button">
17-
<f-icon
18-
size="30px"
19-
icon="f-icon-arrow-right"
20-
@click="switchImage('next')"
21-
/>
19+
<div
20+
v-if="previewList.length > 1"
21+
class="right_button"
22+
@click="switchImage('next')"
23+
>
24+
<f-icon size="30px" icon="f-icon-arrow-right" />
2225
</div>
2326

24-
<div v-if="previewList.length > 1" class="left_button">
25-
<f-icon
26-
size="30px"
27-
icon="f-icon-arrow-left"
28-
@click="switchImage('prev')"
29-
/>
27+
<div
28+
v-if="previewList.length > 1"
29+
class="left_button"
30+
@click="switchImage('prev')"
31+
>
32+
<f-icon size="30px" icon="f-icon-arrow-left" />
3033
</div>
3134

32-
<div v-if="showCloseBtn" class="close_button">
33-
<f-icon size="20px" icon="f-icon-close" @click="close" />
35+
<div v-if="showCloseBtn" class="close_button" @click="close">
36+
<f-icon size="20px" icon="f-icon-close" />
3437
</div>
3538

3639
<div v-if="previewShowOption" class="option" @click="optionClick">
@@ -168,6 +171,7 @@
168171
}
169172
170173
const onImgMousewheel = (evt: WheelEvent): void => {
174+
evt.preventDefault()
171175
if (evt.deltaY > 1) {
172176
smaller()
173177
return

packages/fighting-components/image/src/image.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,6 @@ export const Props = {
5151
type: String,
5252
default: (): string => ''
5353
},
54-
previewList: {
55-
type: Array as PropType<string[]>,
56-
default: (): [] => []
57-
},
58-
previewShowIndex: {
59-
type: Number,
60-
default: (): number => 0
61-
},
62-
previewZIndex: {
63-
type: Number,
64-
default: (): number => 999
65-
},
66-
previewShowOption: {
67-
type: Boolean,
68-
default: (): boolean => true
69-
},
7054
round: {
7155
type: String,
7256
default: (): string => ''
@@ -90,6 +74,26 @@ export const Props = {
9074
showCloseBtn: {
9175
type: Boolean,
9276
default: (): boolean => true
77+
},
78+
previewList: {
79+
type: Array as PropType<string[]>,
80+
default: (): [] => []
81+
},
82+
previewShowIndex: {
83+
type: Number,
84+
default: (): number => 0
85+
},
86+
previewZIndex: {
87+
type: Number,
88+
default: (): number => 999
89+
},
90+
previewShowOption: {
91+
type: Boolean,
92+
default: (): boolean => true
93+
},
94+
previewRound: {
95+
type: String,
96+
default: (): string => ''
9397
}
9498
} as const
9599

packages/fighting-components/image/src/image.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
:previewZIndex="previewZIndex"
4040
:modalClose="modalClose"
4141
:showCloseBtn="showCloseBtn"
42+
:previewRound="previewRound"
4243
@close="onClose"
4344
/>
4445
</div>

packages/fighting-theme/src/image.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969
.right_button,
7070
.left_button,
7171
.close_button {
72-
width: 54px;
73-
height: 54px;
72+
width: 50px;
73+
height: 50px;
7474
background: rgba(255, 255, 255, 0.5);
7575
border-radius: 50%;
7676
position: absolute;

start/src/App.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
alt="ada"
1010
:preview-list="listImg"
1111
:select="true"
12+
:preview-z-index="10022"
13+
:preview-show-option="false"
14+
round="20px"
15+
preview-round="120px"
16+
caption="回到家啊回到家萨的好时机啊的话苏家爱华打算结婚的洒酒大数据坎大哈时间坎大哈时间的撒健康大数据坎大哈事件扩大化"
1217
:preview-show-index="32"
1318
block
1419
/>

0 commit comments

Comments
 (0)