mirror of
https://github.com/nuxt/ui.git
synced 2026-09-14 19:51:10 +08:00
472851df55
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benjamin Canac <canacb1@gmail.com>
36 lines
852 B
TypeScript
36 lines
852 B
TypeScript
export default defineNuxtPlugin({
|
|
enforce: 'post',
|
|
setup() {
|
|
const { framework } = useFrameworks()
|
|
|
|
if (import.meta.client) {
|
|
useHead({
|
|
htmlAttrs: {
|
|
'data-framework': framework
|
|
}
|
|
})
|
|
}
|
|
|
|
if (import.meta.server) {
|
|
useHead({
|
|
script: [{
|
|
innerHTML: `
|
|
function getCookie(name) {
|
|
var value = '; ' + window.document.cookie;
|
|
var parts = value.split('; ' + name + '=');
|
|
if (parts.length === 2) {
|
|
return parts.pop()?.split(';').shift();
|
|
}
|
|
}
|
|
|
|
var f = getCookie('nuxt-ui-framework');
|
|
document.documentElement.setAttribute('data-framework', f || 'nuxt');
|
|
`.replace(/\s+/g, ' '),
|
|
type: 'text/javascript',
|
|
tagPriority: -1
|
|
}]
|
|
})
|
|
}
|
|
}
|
|
})
|