Skip to content

Commit

Permalink
perf: 性能优化
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyh2001 committed Jul 15, 2022
1 parent 0565415 commit c7595b4
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 25 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

English | [Chinese](https://github.com/FightingDesign/fighting-design/blob/master/CHANGELOG.md)

## 0.3.1-bate.4 (2022-07-15)

- `link` component new `default` configuration `type`
- The default value of `button` component `ripple` is changed to `false`

## 0.3.0-bate.3 (2022-07-13)

**feat**
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

中文 | [英文](https://github.com/FightingDesign/fighting-design/blob/master/CHANGELOG.en-US.md)

## 0.3.1-bate.4 (2022-07-15)

- `Link` 组件新增 `default` 配置 `type`
- `button` 组件 `ripples` 默认值改为 `false`

Expand Down
5 changes: 5 additions & 0 deletions docs/docs/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

中文 | [英文](https://github.com/FightingDesign/fighting-design/blob/master/CHANGELOG.en-US.md)

## 0.3.1-bate.4 (2022-07-15)

- `Link` 组件新增 `default` 配置 `type`
- `button` 组件 `ripples` 默认值改为 `false`

## 0.3.0-bate.3 (2022-07-13)

**feat**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { breadcrumbKey } from './breadcrumb'
import { Props } from './breadcrumb-item'
import type { ComponentInternalInstance, Ref } from 'vue'
import type { onClickInterface } from './interface'
import type { handleClickInterface } from './interface'
const prop = defineProps(Props)
Expand All @@ -16,7 +16,7 @@
const { separator, separatorIcon, itemColor, separatorColor } =
toRefs(breadcrumbContext)
const onClick: onClickInterface = (): void => {
const handleClick: handleClickInterface = (): void => {
const { replace, to } = prop
if (!to || !router) {
Expand All @@ -33,7 +33,7 @@
class="f-breadcrumb-item__inner"
:style="{ color: itemColor }"
role="link"
@click="onClick"
@click="handleClick"
>
<slot />
</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-components/breadcrumb/src/interface.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export interface onClickInterface {
export interface handleClickInterface {
(): void
}
10 changes: 0 additions & 10 deletions packages/fighting-components/button/src/interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ export type buttonType =

export type buttonNativeType = 'button' | 'submit' | 'reset'

export interface RipplesInterface {
evt: PointerEvent
node: HTMLElement
time: number
ripplesColor: string
clickRipples(): void
renderElement(x: number, y: number): HTMLSpanElement
removeElement(node: HTMLElement): void
}

export type buttonEventInterface = PointerEvent & {
layerX: number
layerY: number
Expand Down
1 change: 0 additions & 1 deletion packages/fighting-components/captcha/src/captcha.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
document.onmousemove = (evt: MouseEvent): void => {
if (evt.clientX - dis >= 0 && evt.clientX - dis <= 260) {
range.value = Math.floor((evt.clientX - dis) / 2.6)
// range.value = (((evt.clientX - dis) / 260) * 100).toFixed()
node.style.left = evt.clientX - dis + 'px'
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/fighting-components/image/src/PreviewList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
rotate.value = 0
}
const close: ordinaryFunctionInterface = (): void => {
const handleClose: ordinaryFunctionInterface = (): void => {
emit('close')
}
Expand Down Expand Up @@ -165,7 +165,7 @@
<f-icon size="30px" icon="f-icon-arrow-left" />
</div>

<div v-if="showCloseBtn" class="close_button" @click="close">
<div v-if="showCloseBtn" class="close_button" @click="handleClose">
<f-icon size="20px" icon="f-icon-close" />
</div>

Expand Down
8 changes: 4 additions & 4 deletions packages/fighting-components/image/src/image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
null as unknown as HTMLImageElement
)
const onClick: ordinaryFunctionInterface = (): void => {
const handleClick: ordinaryFunctionInterface = (): void => {
if (prop.previewList && prop.previewList.length) {
isPreviewListShow.value = true
}
}
const onClose: ordinaryFunctionInterface = (): void => {
const handleClose: ordinaryFunctionInterface = (): void => {
isPreviewListShow.value = false
}
Expand Down Expand Up @@ -62,7 +62,7 @@
:draggable="draggable"
:referrer-policy="referrerPolicy"
:alt="alt"
@click="onClick"
@click="handleClick"
/>

<div
Expand Down Expand Up @@ -90,7 +90,7 @@
:show-close-btn="showCloseBtn"
:preview-round="previewRound"
:width="width"
@close="onClose"
@close="handleClose"
/>
</div>

Expand Down
9 changes: 6 additions & 3 deletions packages/fighting-components/tag/src/tag.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script lang="ts" setup name="FTag">
import { Props, Emits } from './tag'
import { computed } from 'vue'
import { computed, ref } from 'vue'
import type { handleCloseInterface } from './interface'
import type { ComputedRef } from 'vue'
import type { ComputedRef, Ref } from 'vue'
const prop = defineProps(Props)
const emit = defineEmits(Emits)
const isShow: Ref<boolean> = ref<boolean>(false)
const classList: ComputedRef<object | string[]> = computed(
(): object | string[] => {
const { simple, type, size, block, round } = prop
Expand All @@ -25,12 +27,13 @@
)
const handleClose: handleCloseInterface = (evt: MouseEvent): void => {
isShow.value = false
emit('onClose', evt)
}
</script>

<template>
<div :class="classList" :style="{ background, color }">
<div v-if="isShow" :class="classList" :style="{ background, color }">
<i v-if="leftIcon" :class="['f-icon', leftIcon]" />
<slot />
<i v-if="rightIcon" :class="['f-icon', rightIcon]" />
Expand Down
2 changes: 1 addition & 1 deletion packages/fighting-design/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fighting-design",
"version": "0.3.0-bate.3",
"version": "0.3.1-bate.4",
"description": "Fighting design is a Vue3 lightweight component library written with TypeScript + Template.",
"keywords": [
"fighting",
Expand Down

0 comments on commit c7595b4

Please sign in to comment.