v0.6.22

Instance API

Last updated


This page lists the methods and properties available on the instance returned by new QUI().

Methods


MethodSignatureDescription
langlang(code: string): voidSwitches the locale and triggers a re-render; ignored when code is not in i18n
fragmentfragment(): Promise<DocumentFragment>Renders once more and returns a copy of the root element's child nodes

fragment()


  1. <script>
  2. const card = new QUI({
  3. render: () => `div.card[ h2[ "{{title}}" ] ]`,
  4. data: { title: "QuickUI" },
  5. when: {
  6. rendered: async () => {
  7. document.body.append(await card.fragment());
  8. },
  9. },
  10. });
  11. </script>
Live preview · @pardnchiu/quickui@0.6.22

RuleDescription
RenderingRuns the full template processing once, without calling beforeUpdate / updated
Text nodesLeading and trailing whitespace is trimmed
Return valueA copy; changing it does not affect the instance and it receives no further updates
When to callAfter rendered, so data is ready

Properties


PropertyTypeDescription
dataProxyReactive data, see Reactive Data
eventRecord<string, Function>The original event option object
bodyElementThe mounted root element; the QUIFragment section when there is no id
isScheduledbooleantrue while patches are queued in requestAnimationFrame and not yet applied
lazyloadObserverIntersectionObserverThe shared image lazy-loading observer; undefined when lazyload is disabled

data, event and body are assigned only after i18n finishes loading.
中文