本文整理匯總了TypeScript中popper.js.default.update方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript js.default.update方法的具體用法?TypeScript js.default.update怎麽用?TypeScript js.default.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類popper.js.default
的用法示例。
在下文中一共展示了js.default.update方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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,
示例2: onCreate
positionFixed: true,
placement: 'auto-start',
eventsEnabled: false,
modifiers,
removeOnDestroy: true,
onCreate(data) {
console.log(data);
},
onUpdate(data) {
console.log('x-out-of-boundaries', data.attributes);
console.log('x-placement', data.attributes['x-placement']);
data.styles.alignContent = 'flex-start';
}
};
Popper.modifiers.map(mod => mod.name);
Popper.placements.forEach(placement => placement.toLowerCase());
Popper.Defaults.onCreate = function (data: Data) {
};
const popper = new Popper(document.createElement('div'), document.createElement('span'));
const popperWithOptions = new Popper(document.createElement('div'), document.createElement('span'), options);
popper.options.positionFixed = false;
popper.destroy();
popper.update();
popper.scheduleUpdate();
popper.enableEventListeners();
popper.disableEventListeners();