Bilibili-Evolved/registry/lib/components/style/custom-navbar/mixins.ts
2021-10-26 13:19:37 +08:00

28 lines
626 B
TypeScript

import { CustomNavbarItem } from './custom-navbar-item'
export const popperMixin = Vue.extend({
props: {
item: {
type: CustomNavbarItem,
required: true,
},
container: {
type: HTMLElement,
required: true,
},
},
mounted() {
const navBarItem = this.item as CustomNavbarItem
const containerElement = this.container as HTMLElement
if (containerElement) {
navBarItem?.usePopper(containerElement, this.$el.parentElement)
}
},
methods: {
popupShow() {
const navBarItem = this.item as CustomNavbarItem
navBarItem?.popper?.update()
},
},
})