mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
fix: use head instance from plugin
This commit is contained in:
committed by
Benjamin Canac
parent
f1ed0076e5
commit
791804b2fb
@@ -3,8 +3,9 @@ import colors from '#tailwind-config/theme/colors'
|
||||
|
||||
export default defineNuxtPlugin({
|
||||
enforce: 'post',
|
||||
setup () {
|
||||
setup (nuxtApp) {
|
||||
const appConfig = useAppConfig()
|
||||
const head = nuxtApp.vueApp._context.provides.usehead
|
||||
|
||||
const root = computed(() => {
|
||||
const primary: Record<string, string> | undefined = colors[appConfig.ui.primary]
|
||||
@@ -32,7 +33,7 @@ export default defineNuxtPlugin({
|
||||
appConfig.ui.gray = window.localStorage.getItem('nuxt-ui-gray') || appConfig.ui.gray
|
||||
}
|
||||
if (process.server) {
|
||||
useHead({
|
||||
head.push({
|
||||
script: [
|
||||
{
|
||||
innerHTML: `
|
||||
|
||||
@@ -3,9 +3,9 @@ import { hexToRgb } from '../utils'
|
||||
import { defineNuxtPlugin, useHead, useAppConfig, useNuxtApp } from '#imports'
|
||||
import colors from '#tailwind-config/theme/colors'
|
||||
|
||||
export default defineNuxtPlugin(() => {
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const appConfig = useAppConfig()
|
||||
const nuxtApp = useNuxtApp()
|
||||
const head = nuxtApp.vueApp._context.provides.usehead
|
||||
|
||||
const root = computed(() => {
|
||||
const primary: Record<string, string> | undefined = colors[appConfig.ui.primary]
|
||||
@@ -53,5 +53,6 @@ ${Object.entries(gray || colors.cool).map(([key, value]) => `--color-gray-${key}
|
||||
}]
|
||||
}
|
||||
|
||||
useHead(headData)
|
||||
// Workaround for https://github.com/nuxt/nuxt/issues/22763
|
||||
head.push(headData)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user