This commit is contained in:
mertsincan 2023-10-04 10:20:15 +01:00
parent 4ec4952b97
commit 877d6c07df
13 changed files with 22 additions and 30 deletions

View file

@ -33,16 +33,20 @@ export default {
classes,
inlineStyles,
loadStyle(options = {}) {
return useStyle(this.css, { name: this.name, ...options });
return this.css ? useStyle(this.css, { name: this.name, ...options }) : {};
},
getStyleSheet(extendedCSS = '', props = {}) {
const _props = Object.entries(props)
.reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, [])
.join(' ');
if (this.css) {
const _props = Object.entries(props)
.reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, [])
.join(' ');
return `<style type="text/css" data-primevue-style-id="${this.name}" ${_props}>${this.css}${extendedCSS}</style>`;
return `<style type="text/css" data-primevue-style-id="${this.name}" ${_props}>${this.css}${extendedCSS}</style>`;
}
return '';
},
extend(style) {
return { ...this, ...style };
return { ...this, css: undefined, ...style };
}
};