bug fixes
This commit is contained in:
@@ -7,17 +7,12 @@
|
|||||||
classType,
|
classType,
|
||||||
props.size,
|
props.size,
|
||||||
{ 'button-block': block },
|
{ 'button-block': block },
|
||||||
{ 'dropdown-button': dropdown },
|
{ 'button-dropdown': dropdown },
|
||||||
]"
|
]"
|
||||||
ref="buttonRef"
|
ref="buttonRef"
|
||||||
:style="{ minWidth: minWidth }"
|
:style="{ minWidth: minWidth }"
|
||||||
:type="buttonType"
|
:type="buttonType"
|
||||||
@click="handleClick">
|
@click="handleClick">
|
||||||
<ion-icon
|
|
||||||
v-if="dropdown != null"
|
|
||||||
name="caret-down-outline"
|
|
||||||
class="button-icon-dropdown"
|
|
||||||
@click.stop="handleClickToggleDropdown" />
|
|
||||||
<ul
|
<ul
|
||||||
v-if="dropdown != null"
|
v-if="dropdown != null"
|
||||||
ref="dropdownMenu"
|
ref="dropdownMenu"
|
||||||
@@ -29,7 +24,26 @@
|
|||||||
{{ dropdownLabel }}
|
{{ dropdownLabel }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<span v-if="!loading">{{ props.label }}</span>
|
<template v-if="!loading">
|
||||||
|
<span v-if="iconLocation.length > 0" class="button-label">
|
||||||
|
<ion-icon
|
||||||
|
v-if="icon && iconLocation == 'before'"
|
||||||
|
:icon="icon" />
|
||||||
|
{{ label }}
|
||||||
|
<ion-icon v-if="icon && iconLocation == 'after'" :icon="icon" />
|
||||||
|
</span>
|
||||||
|
<span v-else-if="icon.length > 0" class="button-label">
|
||||||
|
<ion-icon :icon="icon" />
|
||||||
|
</span>
|
||||||
|
<span v-else class="button-label">
|
||||||
|
{{ label }}
|
||||||
|
</span>
|
||||||
|
<ion-icon
|
||||||
|
v-if="dropdown != null"
|
||||||
|
name="caret-down-outline"
|
||||||
|
class="button-icon-dropdown"
|
||||||
|
@click.stop="handleClickToggleDropdown" />
|
||||||
|
</template>
|
||||||
<SMLoadingIcon v-else class="button-icon-loading" />
|
<SMLoadingIcon v-else class="button-icon-loading" />
|
||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
@@ -38,16 +52,22 @@
|
|||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:class="['button', classType, props.size, { 'button-block': block }]"
|
:class="['button', classType, props.size, { 'button-block': block }]"
|
||||||
:type="buttonType">
|
:type="buttonType">
|
||||||
<span class="button-label">{{ label }}</span>
|
<span class="button-label">
|
||||||
|
<ion-icon v-if="icon && iconLocation == 'before'" :icon="icon" />
|
||||||
|
{{ label }}
|
||||||
|
<ion-icon v-if="icon && iconLocation == 'after'" :icon="icon" />
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<router-link
|
<router-link
|
||||||
v-else-if="!isEmpty(to) && typeof to == 'object'"
|
v-else-if="!isEmpty(to) && typeof to == 'object'"
|
||||||
:to="to"
|
:to="to"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:class="['button', classType, props.size, { 'button-block': block }]">
|
:class="['button', classType, props.size, { 'button-block': block }]">
|
||||||
|
<span class="button-label">
|
||||||
<ion-icon v-if="icon && iconLocation == 'before'" :icon="icon" />
|
<ion-icon v-if="icon && iconLocation == 'before'" :icon="icon" />
|
||||||
{{ label }}
|
{{ label }}
|
||||||
<ion-icon v-if="icon && iconLocation == 'after'" :icon="icon" />
|
<ion-icon v-if="icon && iconLocation == 'after'" :icon="icon" />
|
||||||
|
</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -66,10 +86,10 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
iconLocation: {
|
iconLocation: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "after",
|
default: "",
|
||||||
required: false,
|
required: false,
|
||||||
validator: (value: string) => {
|
validator: (value: string) => {
|
||||||
return ["before", "after"].includes(value);
|
return ["before", "after", ""].includes(value);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
to: {
|
to: {
|
||||||
@@ -168,6 +188,53 @@ const handleClickItem = (item: string) => {
|
|||||||
background-color: var(--base-color-light);
|
background-color: var(--base-color-light);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
|
.button-label {
|
||||||
|
ion-icon {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
margin: -8px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.button-dropdown {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.button-icon-dropdown {
|
||||||
|
height: 18px;
|
||||||
|
width: 18px;
|
||||||
|
margin: -2px -18px -2px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.medium .button-icon-dropdown {
|
||||||
|
height: 16px;
|
||||||
|
width: 16px;
|
||||||
|
margin: -4px -18px -3px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
position: absolute;
|
||||||
|
list-style-type: none;
|
||||||
|
display: none;
|
||||||
|
z-index: 10;
|
||||||
|
top: 50%;
|
||||||
|
right: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: inherit;
|
||||||
|
border-color: #999;
|
||||||
|
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 0;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&:hover:not(:disabled) {
|
&:hover:not(:disabled) {
|
||||||
box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
|
box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
|
||||||
|
|||||||
Reference in New Issue
Block a user