Bilibili-Evolved/registry/lib/components/utils/remove-promotions/OptionWidgetLayout.vue

46 lines
910 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<VPopup v-if="isPopup" v-model="popup" :trigger-element="$refs.popupButton" auto-destroy>
<slot />
</VPopup>
<DefaultWidget v-if="isPopup" ref="popupButton" :icon="icon" @click="popup = !popup">
<span>{{ title }}</span>
</DefaultWidget>
<slot v-if="!isPopup" />
</div>
</template>
<script lang="ts">
import { DefaultWidget, VPopup } from '@/ui'
export default Vue.extend({
components: {
DefaultWidget,
VPopup,
},
props: {
/** 是否弹出显示false直接显示内容true显示一个按钮点击弹出显示内容 */
isPopup: {
type: Boolean,
required: true,
},
/** 按钮标题 */
title: {
type: String,
required: true,
},
/** 按钮Icon */
icon: {
type: String,
default: '',
},
},
data() {
return {
popup: false,
}
},
})
</script>