mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 17:02:38 +00:00
Add onLoad option to useStyle
This commit is contained in:
parent
3541f7af25
commit
d0d0a38598
2 changed files with 4 additions and 2 deletions
|
@ -19,7 +19,7 @@ export function useStyle(css, options = {}) {
|
|||
const styleRef = ref(null);
|
||||
|
||||
const defaultDocument = DomHandler.isClient() ? window.document : undefined;
|
||||
const { document = defaultDocument, immediate = true, manual = false, name = `style_${++_id}`, id = undefined, media = undefined, nonce = undefined, first = false, props = {} } = options;
|
||||
const { document = defaultDocument, immediate = true, manual = false, name = `style_${++_id}`, id = undefined, media = undefined, nonce = undefined, first = false, onLoad = undefined, props = {} } = options;
|
||||
|
||||
let stop = () => {};
|
||||
|
||||
|
@ -44,6 +44,7 @@ export function useStyle(css, options = {}) {
|
|||
first ? document.head.prepend(styleRef.value) : document.head.appendChild(styleRef.value);
|
||||
DomHandler.setAttribute(styleRef.value, 'data-primevue-style-id', name);
|
||||
DomHandler.setAttributes(styleRef.value, _styleProps);
|
||||
styleRef.value.onload = onLoad;
|
||||
}
|
||||
|
||||
if (isLoaded.value) return;
|
||||
|
@ -74,6 +75,7 @@ export function useStyle(css, options = {}) {
|
|||
return {
|
||||
id,
|
||||
name,
|
||||
el: styleRef,
|
||||
css: cssRef,
|
||||
unload,
|
||||
load,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue