mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 09:25:54 +00:00
fix(nuxt3): provide NuxtWelcome
component from design (#745)
This commit is contained in:
parent
d09a5531f2
commit
9c619b8772
@ -51,7 +51,8 @@
|
||||
"object-hash": "^2.2.0",
|
||||
"pathe": "^0.2.0",
|
||||
"typescript": "^4.4.3",
|
||||
"unbuild": "^0.5.6"
|
||||
"unbuild": "^0.5.6",
|
||||
"vue-router": "next"
|
||||
},
|
||||
"packageManager": "yarn@3.0.2"
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
"dependencies": {
|
||||
"@cloudflare/kv-asset-handler": "^0.1.3",
|
||||
"@netlify/functions": "^0.7.2",
|
||||
"@nuxt/design": "0.1.1",
|
||||
"@nuxt/design": "0.1.3",
|
||||
"@nuxt/devalue": "^2.0.0",
|
||||
"@nuxt/kit": "3.0.0",
|
||||
"@rollup/plugin-alias": "^3.1.5",
|
||||
|
@ -23,7 +23,7 @@
|
||||
"fsevents": "~2.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nuxt/design": "0.1.1",
|
||||
"@nuxt/design": "0.1.3",
|
||||
"@nuxt/kit": "3.0.0",
|
||||
"@types/clear": "^0",
|
||||
"@types/debounce-promise": "^3",
|
||||
|
@ -18,6 +18,7 @@
|
||||
"prepack": "unbuild"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxt/design": "^0.1.3",
|
||||
"@nuxt/kit": "3.0.0",
|
||||
"@nuxt/nitro": "3.0.0",
|
||||
"@nuxt/vite-builder": "3.0.0",
|
||||
|
@ -1,79 +0,0 @@
|
||||
<template>
|
||||
<div class="relative flex items-top justify-center min-h-screen bg-gray-100 dark:bg-gray-900 sm:items-center sm:pt-0">
|
||||
<Link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet" />
|
||||
<div class="max-w-4xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="flex justify-center pt-8 sm:justify-start sm:pt-0">
|
||||
<svg width="221" height="65" viewBox="0 0 221 65" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M76.333 20.5005H82.8185L96.5631 42.4764V20.5005H102.55V51.6393H96.1087L82.3198 29.7091V51.6393H76.333V20.5005Z" fill="currentColor" />
|
||||
<path d="M129.311 51.6393H123.732V48.1611C122.462 50.6089 119.877 51.9871 116.612 51.9871C111.441 51.9871 108.083 48.3393 108.083 43.0894V29.2178H113.662V41.9416C113.662 45.0111 115.568 47.1459 118.425 47.1459C121.555 47.1459 123.732 44.7437 123.732 41.4524V29.2178H129.311V51.6393Z" fill="currentColor" />
|
||||
<path d="M148.724 51.2848L143.372 43.811L138.019 51.2848H132.076L140.333 39.5849L132.712 28.8633H138.79L143.372 35.3154L147.906 28.8633H154.031L146.364 39.5849L154.62 51.2848H148.724Z" fill="currentColor" />
|
||||
<path d="M165.96 22.4565V29.2173H172.311V33.7999H165.96V44.9302C165.96 45.304 166.111 45.6626 166.381 45.9271C166.65 46.1916 167.015 46.3405 167.397 46.3411H172.311V51.6302H168.636C163.646 51.6302 160.381 48.7824 160.381 43.8042V33.8043H155.891V29.2173H158.708C160.022 29.2173 160.787 28.45 160.787 27.1804V22.4565H165.96Z" fill="currentColor" />
|
||||
<path d="M186.374 44.5872V20.5005H192.359V42.7416C192.359 48.748 189.411 51.6393 184.422 51.6393H177.455V46.3502H184.577C185.053 46.3502 185.511 46.1645 185.848 45.8339C186.185 45.5032 186.374 45.0548 186.374 44.5872" fill="currentColor" />
|
||||
<path d="M195.945 41.1847H201.708C202.027 44.6629 204.386 46.8781 208.196 46.8781C211.598 46.8781 213.959 45.5455 213.959 42.7869C213.959 36.113 196.892 40.739 196.892 28.8174C196.896 23.7023 201.387 20.1479 207.839 20.1479C214.553 20.1479 219.088 23.9283 219.365 29.7565H213.633C213.363 27.0435 211.195 25.2196 207.828 25.2196C204.698 25.2196 202.748 26.6435 202.748 28.8218C202.748 35.7174 220.037 30.5609 220.037 42.7021C220.037 48.4846 215.182 51.9998 208.198 51.9998C200.986 51.9998 196.269 47.7281 195.952 41.189" fill="currentColor" />
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.7513 14.261C28.0767 11.3817 23.8903 11.3817 22.2157 14.261L3.96535 45.641C2.29077 48.5204 4.38399 52.1195 7.73316 52.1195H21.9804C20.5493 50.8688 20.0193 48.7051 21.1023 46.8487L34.9243 23.1556L29.7513 14.261Z" fill="#80EEC0" />
|
||||
<path d="M41.3151 21.1443C42.701 18.7885 46.1656 18.7885 47.5515 21.1443L62.6552 46.8188C64.0411 49.1746 62.3088 52.1194 59.537 52.1194H29.3296C26.5579 52.1194 24.8255 49.1746 26.2114 46.8188L41.3151 21.1443Z" fill="#00DC82" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="mt-8 bg-white dark:bg-gray-800 overflow-hidden shadow sm:rounded-lg">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="p-6">
|
||||
<div class="flex items-center">
|
||||
<svg
|
||||
class="w-6 h-6 text-gray-500"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" /><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" /></svg>
|
||||
<div class="ml-4 text-lg leading-7 font-semibold">
|
||||
<a href="https://nuxtjs.com" class="hover:underline text-gray-900 dark:text-white">Documentation</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-10">
|
||||
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
|
||||
We highly recommend you take a look at the Nuxt documentation, whether you are new or have previous experience with the framework.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-6 border-t border-gray-200 dark:border-gray-700 md:border-t-0 md:border-l">
|
||||
<div class="flex items-center">
|
||||
<svg
|
||||
class="w-6 h-6 text-gray-500"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
><path d="M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z" /></svg>
|
||||
<div class="ml-4 text-lg leading-7 font-semibold">
|
||||
<a href="https://twitter.com/nuxt_js" class="hover:underline text-gray-900 dark:text-white">Twitter</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-10">
|
||||
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
|
||||
Follow the Nuxt Twitter account to get latest news about releases, new modules, tutorials and tips.<br>
|
||||
<a href="https://twitter.com/nuxt_js" class="text-green-500">@nuxt_js</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 text-sm bg-white border-l-8 border-green-400 dark:bg-gray-800 overflow-hidden shadow sm:rounded-lg p-6 pl-4">
|
||||
<p>To remove this welcome page, <strong class="font-bold">you have 2 options</strong>:</p>
|
||||
<ul class="list-inside list-disc pt-1 pl-2">
|
||||
<li>Create an <code class="text-green-500">app.vue</code></li>
|
||||
<li>Create a <code class="text-green-500">pages/index.vue</code></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
9
packages/nuxt3/src/app/components/nuxt-welcome.vue
Normal file
9
packages/nuxt3/src/app/components/nuxt-welcome.vue
Normal file
@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<div v-html="html" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { welcome as welcomeTemplate } from '@nuxt/design'
|
||||
const html = welcomeTemplate({})
|
||||
</script>
|
@ -1,5 +1,5 @@
|
||||
/* eslint-disable no-use-before-define */
|
||||
import { getCurrentInstance, reactive } from 'vue'
|
||||
import { getCurrentInstance, reactive, defineAsyncComponent } from 'vue'
|
||||
import type { App, VNode } from 'vue'
|
||||
import { createHooks, Hookable } from 'hookable'
|
||||
import { defineGetter } from './utils'
|
||||
@ -100,6 +100,11 @@ export function createNuxtApp (options: CreateOptions) {
|
||||
nuxt.ssrContext.nuxt = nuxt
|
||||
}
|
||||
|
||||
// (temporary) Expose NuxtWelcome component in dev
|
||||
if (process.dev) {
|
||||
nuxt.app.component('NuxtWelcome', defineAsyncComponent(() => import('./components/nuxt-welcome.vue')))
|
||||
}
|
||||
|
||||
if (process.server) {
|
||||
// Expose to server renderer to create window.__NUXT__
|
||||
nuxt.ssrContext = nuxt.ssrContext || {}
|
||||
|
@ -63,7 +63,7 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) {
|
||||
app.main = tryResolvePath('~/App', resolveOptions) || tryResolvePath('~/app', resolveOptions)
|
||||
}
|
||||
if (!app.main) {
|
||||
app.main = resolve(nuxt.options.appDir, 'app.tutorial.vue')
|
||||
app.main = resolve(nuxt.options.appDir, 'components/nuxt-welcome.vue')
|
||||
}
|
||||
|
||||
// Resolve plugins
|
||||
|
@ -25,7 +25,7 @@ export default defineNuxtModule({
|
||||
|
||||
// Add default layout for pages
|
||||
nuxt.hook('app:resolve', (app) => {
|
||||
if (app.main.includes('app.tutorial')) {
|
||||
if (app.main.includes('nuxt-welcome')) {
|
||||
app.main = resolve(runtimeDir, 'app.vue')
|
||||
}
|
||||
})
|
||||
|
16
yarn.lock
16
yarn.lock
@ -2511,10 +2511,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@nuxt/design@npm:0.1.1":
|
||||
version: 0.1.1
|
||||
resolution: "@nuxt/design@npm:0.1.1"
|
||||
checksum: ccdcfaaae848cf36bf7fb555ff1c5715de8ee6004a26412ea156a0c2812e01ad0503b68ebb4ad23c07ec9c536199325d416410e231d060753ac212184f902b55
|
||||
"@nuxt/design@npm:0.1.3, @nuxt/design@npm:^0.1.3":
|
||||
version: 0.1.3
|
||||
resolution: "@nuxt/design@npm:0.1.3"
|
||||
checksum: 57f8cb6119b96eb51f12f4b643fc46bcf9879359a4d8ae4576d2f12b39876344c3cbcf13360f5844b53eef9d08367c91872520aa90256a32e2c0f028233a5269
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -2612,7 +2612,7 @@ __metadata:
|
||||
dependencies:
|
||||
"@cloudflare/kv-asset-handler": ^0.1.3
|
||||
"@netlify/functions": ^0.7.2
|
||||
"@nuxt/design": 0.1.1
|
||||
"@nuxt/design": 0.1.3
|
||||
"@nuxt/devalue": ^2.0.0
|
||||
"@nuxt/kit": 3.0.0
|
||||
"@rollup/plugin-alias": ^3.1.5
|
||||
@ -13643,7 +13643,7 @@ fsevents@~2.3.2:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "nuxi@workspace:packages/nuxi"
|
||||
dependencies:
|
||||
"@nuxt/design": 0.1.1
|
||||
"@nuxt/design": 0.1.3
|
||||
"@nuxt/kit": 3.0.0
|
||||
"@types/clear": ^0
|
||||
"@types/debounce-promise": ^3
|
||||
@ -13701,6 +13701,7 @@ fsevents@~2.3.2:
|
||||
pathe: ^0.2.0
|
||||
typescript: ^4.4.3
|
||||
unbuild: ^0.5.6
|
||||
vue-router: next
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@ -13737,6 +13738,7 @@ fsevents@~2.3.2:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "nuxt3@workspace:packages/nuxt3"
|
||||
dependencies:
|
||||
"@nuxt/design": ^0.1.3
|
||||
"@nuxt/kit": 3.0.0
|
||||
"@nuxt/nitro": 3.0.0
|
||||
"@nuxt/vite-builder": 3.0.0
|
||||
@ -19349,7 +19351,7 @@ fsevents@~2.3.2:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"vue-router@npm:^4.0.11":
|
||||
"vue-router@npm:^4.0.11, vue-router@npm:next":
|
||||
version: 4.0.11
|
||||
resolution: "vue-router@npm:4.0.11"
|
||||
dependencies:
|
||||
|
Loading…
Reference in New Issue
Block a user