feat: improve cursor
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
text-align: center;
|
||||
background-color: @action-sheet-item-background;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
|
||||
&:active {
|
||||
background-color: @active-color;
|
||||
@@ -23,6 +24,7 @@
|
||||
&__item {
|
||||
height: @action-sheet-item-height;
|
||||
|
||||
&--loading,
|
||||
&--disabled {
|
||||
color: @action-sheet-item-disabled-text-color;
|
||||
|
||||
@@ -30,6 +32,14 @@
|
||||
background-color: @action-sheet-item-background;
|
||||
}
|
||||
}
|
||||
|
||||
&--disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&--loading {
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
&__subname {
|
||||
|
||||
@@ -70,17 +70,17 @@ function ActionSheet(
|
||||
}
|
||||
|
||||
function Option(item: ActionSheetItem, index: number) {
|
||||
const disabled = item.disabled || item.loading;
|
||||
const { disabled, loading, callback } = item;
|
||||
|
||||
function onClickOption(event: MouseEvent) {
|
||||
event.stopPropagation();
|
||||
|
||||
if (item.disabled || item.loading) {
|
||||
if (disabled || loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.callback) {
|
||||
item.callback(item);
|
||||
if (callback) {
|
||||
callback(item);
|
||||
}
|
||||
|
||||
emit(ctx, 'select', item, index);
|
||||
@@ -91,7 +91,7 @@ function ActionSheet(
|
||||
}
|
||||
|
||||
function OptionContent() {
|
||||
if (item.loading) {
|
||||
if (loading) {
|
||||
return <Loading size="20px" />;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ function ActionSheet(
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
class={[bem('item', { disabled }), item.className, BORDER_TOP]}
|
||||
class={[bem('item', { disabled, loading }), item.className, BORDER_TOP]}
|
||||
style={{ color: item.color }}
|
||||
onClick={onClickOption}
|
||||
>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`callback events 1`] = `
|
||||
<div class="van-popup van-popup--round van-popup--bottom van-popup--safe-area-inset-bottom van-action-sheet" name="van-popup-slide-bottom"><button type="button" class="van-action-sheet__item van-hairline--top"><span class="van-action-sheet__name">Option</span></button><button type="button" class="van-action-sheet__item van-action-sheet__item--disabled van-hairline--top"><span class="van-action-sheet__name">Option</span></button><button type="button" class="van-action-sheet__item van-action-sheet__item--disabled van-hairline--top">
|
||||
<div class="van-popup van-popup--round van-popup--bottom van-popup--safe-area-inset-bottom van-action-sheet" name="van-popup-slide-bottom"><button type="button" class="van-action-sheet__item van-hairline--top"><span class="van-action-sheet__name">Option</span></button><button type="button" class="van-action-sheet__item van-action-sheet__item--disabled van-hairline--top"><span class="van-action-sheet__name">Option</span></button><button type="button" class="van-action-sheet__item van-action-sheet__item--loading van-hairline--top">
|
||||
<div class="van-loading van-loading--circular"><span class="van-loading__spinner van-loading__spinner--circular" style="width: 20px; height: 20px;"><svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
|
||||
</button><button type="button" class="van-action-sheet__item van-hairline--top"><span class="van-action-sheet__name">Option</span><span class="van-action-sheet__subname">Subname</span></button><button type="button" class="van-action-sheet__cancel">Cancel</button></div>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user