Skip to content

베타

이 App Bridge 컴포넌트는 새로 추가되었으며, 베타 기간에는 마이너 릴리스에서 API가 바뀔 수 있습니다. 동작은 로컬 E2E 스위트가 실제 Shopify admin에서 확인합니다. 문제가 있으면 issue를 등록해 주세요.

요소와 속성 ​

App Bridge의 요소 인터페이스와 속성 타입, 그리고 이들만 사용하는 타입입니다. 이 페이지: SAppWindowAttributes, SAppWindowElement, UIModalElement, UINavMenuAttributes.

SAppWindowAttributes ​

interface

Attributes for the app window element. This element displays a fullscreen modal window in the Shopify admin.

가져오기: import type { SAppWindowAttributes } from 'polaris-vue-elements/app-bridge'

id?: string

A unique identifier you assign to the app window element. Used when connecting buttons via commandFor or accessing the element with document.getElementById(). Choose a descriptive name like "settings-window" or "edit-modal".

src: string

The URL of the content to display within the app window. Must point to a route within your app that renders the window content. The URL is loaded in an iframe when the window opens. Commonly used for multi-step workflows, bulk editors, or detailed views that need full-screen space.

사용처: AppWindow

SAppWindowElement ​

interface

declare global에 선언되어 있어 import 없이 사용할 수 있습니다.

확장: Omit<HTMLElement, "addEventListener" | "removeEventListener">, Required<Omit<_SAppWindowElement, "src" | "contentWindow">>, Pick<_SAppWindowElement, "src" | "contentWindow">

사용처: SaveBar, AppWindow

_SAppWindowElement ​

interface

src?: string

Gets or sets the URL of the content displayed in the app window. Changing this value while the window is open navigates to the new URL. Commonly used for dynamic navigation within an open window.

readonly contentWindow?: Window | null

Returns the Window object of the app window iframe, or null if the window is closed. Use this to communicate with the iframe content via postMessage() or access its document. Only accessible when the app window is open.

show?(): Promise<void>

Opens the app window and displays the content from the src URL. Returns a Promise that resolves when the window is fully visible. Use await or .then() to run code after the window opens. Commonly used for launching workflows triggered by user actions.

hide?(): Promise<void>

Closes the app window. Returns a Promise that resolves when the window is fully hidden. Any unsaved changes in forms with data-save-bar will prompt the user before closing. Commonly used for programmatic close after completing a workflow.

toggle?(): Promise<void>

Toggles the app window between open and closed states. Returns a Promise that resolves when the transition completes. Opens the window if closed, closes it if open. Commonly used for toggle buttons that control window visibility.

addEventListener?(type: "show" | "hide", listener: EventListenerOrEventListenerObject): void

Adds an event listener for app window lifecycle events. Supported events: show fires when the window opens, hide fires when the window closes. Commonly used for tracking analytics, updating UI state, or cleaning up resources when the window closes.

removeEventListener?(type: "show" | "hide", listener: EventListenerOrEventListenerObject): void

Removes a previously added event listener. Pass the same event type and listener function that was used with addEventListener(). Commonly used for cleanup when a component unmounts to prevent memory leaks.

UIModalElement ​

interface

declare global에 선언되어 있어 import 없이 사용할 수 있습니다.

확장: Omit<HTMLElement, "addEventListener" | "removeEventListener">, Required<Omit<_UIModalElement, "content" | "src" | "contentWindow">>, Pick<_UIModalElement, "content" | "src" | "contentWindow">

사용처: Modal

_UIModalElement ​

interface

variant?: "small" | "base" | "large" | "max"

A getter/setter that is used to set modal variant.

content?: HTMLElement

A getter/setter that is used to get the DOM content of the modal element and update the content after the modal has been opened.

src?: string

A getter/setter that is used to set modal src.

readonly contentWindow?: Window | null

A getter that is used to get the Window object of the modal iframe when the modal is used with a src attribute. This can only be accessed when the modal is open, so it is recommended to use await modal.show() before accessing this property.

show?(): Promise<void>

Shows the modal element

hide?(): Promise<void>

Hides the modal element

toggle?(): Promise<void>

Toggles the modal element between the showing and hidden states

addEventListener?(type: "show" | "hide", listener: EventListenerOrEventListenerObject): void

Add 'show' | 'hide' event listeners.

removeEventListener?(type: "show" | "hide", listener: EventListenerOrEventListenerObject): void

Remove 'show' | 'hide' event listeners.

사용처: UIModalElement

UINavMenuAttributes ​

interface

가져오기: import type { UINavMenuAttributes } from 'polaris-vue-elements/app-bridge'

children?: any

타입에 설명이 없습니다.

사용처: NavMenu

MIT 라이선스로 배포됩니다. Vue 로고: Evan You, CC BY-NC-SA 4.0.