mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-21 07:21:46 +01:00
docs: add @nuxt/ui-pro source (#2775)
This commit is contained in:
38
docs/app/plugins/data.ts
Normal file
38
docs/app/plugins/data.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
export default defineNuxtPlugin({
|
||||
enforce: 'post',
|
||||
setup() {
|
||||
const { framework, module } = useSharedData()
|
||||
|
||||
if (import.meta.client) {
|
||||
useHead({
|
||||
htmlAttrs: {
|
||||
'data-framework': framework,
|
||||
'data-module': module
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
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');
|
||||
var m = getCookie('nuxt-ui-module');
|
||||
document.documentElement.setAttribute('data-module', m || 'ui');
|
||||
`.replace(/\s+/g, ' '),
|
||||
type: 'text/javascript',
|
||||
tagPriority: -1
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user