Skip to content

HTML5 bootstrap (JS components) API

HTML5 浏览器 API —— Canvas 2D 绘图、用于客户端键/值数据的 Web Storage,以及 Geolocation。

1 class · 5 methods

Canvas

5 methods

Canvas 2D 渲染上下文,用于以编程方式绘制形状、文本和图像。

new bootstrap.Modal(element, options?)

返回用于在画布上绘图的 2D 渲染上下文。

Parameters

NameTypeDescription
elementElement | stringModal element or selector.
optionsobjectOptional { backdrop, keyboard, focus }.

Returns

Modal

Example

bootstrap
const myModal = new bootstrap.Modal('#myModal');
myModal.show();
Component.getOrCreateInstance(element, options?)

使用当前 fillStyle 绘制填充矩形。

Returns

Component instance

Example

bootstrap
const m = bootstrap.Modal.getOrCreateInstance('#myModal');
m.hide();
instance.show() / .hide() / .toggle()

向当前子路径添加圆弧。之后调用 fill() 或 stroke() 来渲染。

Returns

void

Example

bootstrap
const tooltip = bootstrap.Tooltip.getOrCreateInstance('#btn');
tooltip.show();
tooltip.hide();
instance.dispose()

使用当前字体和 fillStyle 在指定坐标处绘制填充文本。

Returns

void

Example

bootstrap
const popover = bootstrap.Popover.getInstance('#btn');
if (popover) popover.dispose();
instance.update()

将图像、画布或视频以指定位置和大小绘制到画布上。

Returns

void

Example

bootstrap
const dropdown = new bootstrap.Dropdown('#menuBtn');
dropdown.update();