UI › LAYER
BINDING

Selection.layer() + dataset

Bind click-to-popup via xjs('.btn').layer(options), or via data-layer-* attributes.

Binding example
JavaScript
HTML
CSS
// 1) Bind with explicit options
xjs('.btn-delete').layer({
  title: 'Delete item?',
  text: 'This action cannot be undone.',
  icon: 'warning',
  showCancelButton: true
});

// 2) Bind from data-* (no JS options needed)
xjs('.btn-data').layer();
<button class="btn danger btn-delete">Delete (bind .layer)</button>

<button
  class="btn btn-data"
  data-layer-title="Data-driven popup"
  data-layer-text="Configured via data-layer-* attributes"
  data-layer-icon="success"
  data-layer-cancel="true"
>Open (data-layer-*)</button>
/* Local styles for buttons only */
功能说明:验证 Selection.layer() 的去重绑定与 dataset 解析(data-layer-title/text/icon/cancel)。
Re-binding calls should replace old handlers automatically. xjs('.btn').layer(options)
Previous
Next