2021-07-13 17:30:41 +08:00
|
|
|
|
2021-07-15 14:08:13 +08:00
|
|
|
import type { PropType } from 'vue'
|
|
|
|
import type { Options } from '@popperjs/core'
|
2021-07-13 17:30:41 +08:00
|
|
|
|
2021-07-15 14:08:13 +08:00
|
|
|
export const DEFAULT_FALLBACK_PLACEMENTS = []
|
2021-07-13 17:30:41 +08:00
|
|
|
|
2021-07-15 14:08:13 +08:00
|
|
|
export const defaultModifiers = [
|
|
|
|
{
|
|
|
|
name: 'offset',
|
|
|
|
options: {
|
|
|
|
offset: [0, 12],
|
2021-07-13 17:30:41 +08:00
|
|
|
},
|
2021-07-15 14:08:13 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'preventOverflow',
|
|
|
|
options: {
|
|
|
|
padding: {
|
|
|
|
top: 2,
|
|
|
|
bottom: 2,
|
|
|
|
left: 5,
|
|
|
|
right: 5,
|
2021-07-13 17:30:41 +08:00
|
|
|
},
|
|
|
|
},
|
2021-07-15 14:08:13 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'flip',
|
|
|
|
options: {
|
|
|
|
padding: 5,
|
|
|
|
fallbackPlacements: [],
|
2021-07-13 17:30:41 +08:00
|
|
|
},
|
2021-07-15 14:08:13 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'computeStyles',
|
|
|
|
options: {
|
|
|
|
gpuAcceleration: true,
|
|
|
|
adaptive: true,
|
2021-07-13 17:30:41 +08:00
|
|
|
},
|
2021-07-15 14:08:13 +08:00
|
|
|
},
|
|
|
|
]
|
2021-07-13 17:30:41 +08:00
|
|
|
|
2021-07-15 14:08:13 +08:00
|
|
|
export const defaultPopperOptions = {
|
|
|
|
type: Object as PropType<Options>,
|
|
|
|
default: () => {
|
|
|
|
return {
|
|
|
|
fallbackPlacements: DEFAULT_FALLBACK_PLACEMENTS,
|
|
|
|
strategy: 'fixed',
|
|
|
|
modifiers: defaultModifiers,
|
|
|
|
}
|
|
|
|
},
|
2021-07-13 17:30:41 +08:00
|
|
|
}
|