Dynamic Iframe
<bk-dynamic-iframe></bk-dynamic-iframe>
The Dynamic Iframe allows to render an iframe with a dynamic source url.
Particularly, the source url of the rendered iframe may be dependent from the value of the url of the page in which the Dynamic Iframe is mounted.
How to configure
The urlMask
and src
properties of the Dynamic Iframe should be initialized.
{
"tag": "bk-dynamic-iframe",
"properties": {
"urlMask": "/order-details/:id",
"src": "/timeline/order/{{id}}"
}
}
Upon connecting to the DOM, the Dynamic Iframe
- uses the
urlMask
to extract parameters from the window url - computes the source url of the iframe to render by interpolating the data extracted from the previous step inside the
src
property - renders an iframe having source equal to the result of the previous step
Examples
A Dynamic Iframe configured like the following
{
"tag": "bk-dynamic-iframe",
"properties": {
"urlMask": {
"search": "\\?:search"
},
"src": "timeline/order?{{search}}"
}
}
mounted in a page with URl /orders-list?_p=_id,name&_l=10
will render an iframe like:
<iframe src="timeline/order?_p=_id,name&_l=10"></iframe>
API
Properties & Attributes
property | attribute | type | default | description |
---|---|---|---|---|
urlMask | url-mask | UrlMask | - | url mask to apply to the current path to extract dynamic parameters |
src | src | string | - | the url source of the rendered iframe |
Listens to
This component listens to no event.
Emits
This component emits no event.