本文整理汇总了TypeScript中popper.js.default.scheduleUpdate方法的典型用法代码示例。如果您正苦于以下问题:TypeScript js.default.scheduleUpdate方法的具体用法?TypeScript js.default.scheduleUpdate怎么用?TypeScript js.default.scheduleUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类popper.js.default
的用法示例。
在下文中一共展示了js.default.scheduleUpdate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: reposition
// Reposition the popup as it is shown or if its size changes
function reposition() {
const element = findDialogData();
if (element) {
if (popper) {
popper.scheduleUpdate();
} else {
const popperOptions = {
placement: 'top-start',
eventsEnabled: false,
modifiers: {
preventOverflow: {
priority: ['bottom', 'top', 'right', 'left']
},
flip: {
behavior: ['top', 'bottom', 'right', 'left']
},
offset: {
offset: '0,5px'
},
arrow: {
element: '.arrow'
}
}
} as any;
const boundariesElement = $attrs.itemPopupBoundaryClass
? document.getElementsByClassName($attrs.itemPopupBoundaryClass)[0]
: undefined;
if (boundariesElement) {
popperOptions.modifiers.preventOverflow.boundariesElement = boundariesElement;
popperOptions.modifiers.flip.boundariesElement = boundariesElement;
}
popper = new Popper(element, dialog[0], popperOptions);
popper.scheduleUpdate(); // helps fix arrow position
}
}
}
示例2: Popper
import Popper from 'popper.js';
const reference = document.querySelector('.my-button');
const popper = document.querySelector('.my-popper');
const boundary = document.querySelector('.my-boundary');
const arrow = document.querySelector('.my-arrow');
const thePopper = new Popper(
reference,
popper,
);
thePopper.update();
thePopper.scheduleUpdate();
thePopper.destroy();
thePopper.enableEventListeners();
thePopper.disableEventListeners();
Popper.modifiers.forEach(console.log.bind(console));
Popper.placements.forEach(console.log.bind(console));
const thePopperWithOptions = new Popper(
reference,
popper,
{
placement: 'bottom',
eventsEnabled: true,
removeOnDestroy: true,
modifiers: {
shift: {
enabled: true,
fn: (data) => data,