mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 17:02:38 +00:00
Fixed #4230 - Add custom global.css option to Pass Through(PT)
This commit is contained in:
parent
96357a5a1b
commit
596f3abed9
3 changed files with 49 additions and 20 deletions
|
@ -23,17 +23,23 @@ export function useStyle(css, options = {}) {
|
|||
|
||||
let stop = () => {};
|
||||
|
||||
const load = () => {
|
||||
/* @todo: Improve _options params */
|
||||
const load = (_css, _options = {}) => {
|
||||
if (!document) return;
|
||||
|
||||
styleRef.value = document.querySelector(`style[data-primevue-style-id="${name}"]`) || document.getElementById(id) || document.createElement('style');
|
||||
const [_name, _id] = [_options.name || name, _options.id || id];
|
||||
|
||||
styleRef.value = document.querySelector(`style[data-primevue-style-id="${_name}"]`) || document.getElementById(_id) || document.createElement('style');
|
||||
|
||||
if (!styleRef.value.isConnected) {
|
||||
cssRef.value = _css || css;
|
||||
|
||||
styleRef.value.type = 'text/css';
|
||||
id && (styleRef.value.id = id);
|
||||
_id && (styleRef.value.id = _id);
|
||||
media && (styleRef.value.media = media);
|
||||
document.head.appendChild(styleRef.value);
|
||||
name && styleRef.value.setAttribute('data-primevue-style-id', name);
|
||||
DomHandler.setAttributes(styleRef.value, _options);
|
||||
}
|
||||
|
||||
if (isLoaded.value) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue