mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-24 12:44:04 +02:00
fix(frontend): loosen MkButton props type (#17329)
This commit is contained in:
@@ -20,9 +20,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
</component>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
interface MkButtonBase {
|
import { nextTick, computed, onMounted, useTemplateRef } from 'vue';
|
||||||
type?: string;
|
import MkA from '@/components/global/MkA.vue';
|
||||||
|
import type { MkABehavior } from '@/components/global/MkA.vue';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
type?: 'button' | 'submit' | 'reset' | 'a' | 'routerLink';
|
||||||
primary?: boolean;
|
primary?: boolean;
|
||||||
gradate?: boolean;
|
gradate?: boolean;
|
||||||
rounded?: boolean;
|
rounded?: boolean;
|
||||||
@@ -37,37 +41,21 @@ interface MkButtonBase {
|
|||||||
asLike?: boolean;
|
asLike?: boolean;
|
||||||
iconOnly?: boolean;
|
iconOnly?: boolean;
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
}
|
|
||||||
|
|
||||||
interface MkButtonAsButton extends MkButtonBase {
|
// for type=button
|
||||||
type?: 'button' | 'submit' | 'reset';
|
|
||||||
name?: string;
|
name?: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}
|
|
||||||
|
|
||||||
interface MkButtonAsLink extends MkButtonBase {
|
// for type=a
|
||||||
type: 'a';
|
href?: string;
|
||||||
href: string;
|
|
||||||
target?: string;
|
target?: string;
|
||||||
rel?: string;
|
rel?: string;
|
||||||
}
|
|
||||||
|
|
||||||
interface MkButtonAsRouterLink extends MkButtonBase {
|
// for type=routerLink
|
||||||
type: 'routerLink';
|
to?: string;
|
||||||
to: string;
|
|
||||||
linkBehavior?: MkABehavior;
|
linkBehavior?: MkABehavior;
|
||||||
}
|
}>();
|
||||||
|
|
||||||
export type MkButtonProps = MkButtonAsButton | MkButtonAsLink | MkButtonAsRouterLink;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { nextTick, computed, onMounted, useTemplateRef } from 'vue';
|
|
||||||
import MkA from '@/components/global/MkA.vue';
|
|
||||||
import type { MkABehavior } from '@/components/global/MkA.vue';
|
|
||||||
|
|
||||||
const props = defineProps<MkButtonProps>();
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(ev: 'click', payload: PointerEvent): void;
|
(ev: 'click', payload: PointerEvent): void;
|
||||||
|
|||||||
Reference in New Issue
Block a user