我尝试使用以下命令创建新的 nuxt 应用程序
npx nuxi init my-app
Run Code Online (Sandbox Code Playgroud)
成功创建了带有 Nuxt 3.0 stable 的新应用程序,但我得到了这个恼人的响应
Nuxi 3.0.0-rc.10 15:04:22
ERROR (node:35527) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Run Code Online (Sandbox Code Playgroud)
让我困惑的是Nuxi 3.0.0-rc.10的版本和我相信它来自节点的错误。
节点 - 18.12.1
npm - 8.19.2
git-2.38.1
Nuxt在2.13发布了runtimeConfig并告诉我们从本文中的dotenv迁移
我创建了一个.env文件,在其中写入了变量,并确保在.gitignore文件中忽略该文件。
在 nuxt.config.js 中我添加了以下内容
privateRuntimeConfig: {
apiKey: process.env.apiKey,
}
Run Code Online (Sandbox Code Playgroud)
像这样我可以访问 nuxt.config.js 中的 apiKey 并且效果很好。不过,我使用谷歌地图插件,我需要将 apiKey 放入我创建的插件 js 文件中。我正在尝试类似的操作,但无法访问我的 .env 变量。
import Vue from 'vue'
import x5GMaps from 'x5-gmaps'
export default ({ app }) => { Vue.use(x5GMaps, app.context.$config.apiKey) }
Run Code Online (Sandbox Code Playgroud) 我有一个用 Nuxt 创建的基本通用应用程序。
我是 vue 和 nuxt 的新手,我试图了解路由的工作原理,更具体地说明嵌套路由的工作原理。
所以我的项目结构是
??? parent
? ??? child1.vue
? ??? child2.vue
??? parent.vue
Run Code Online (Sandbox Code Playgroud)
在父页面中,我有 child1 和 child2 的两个链接
??? parent
? ??? child1.vue
? ??? child2.vue
??? parent.vue
Run Code Online (Sandbox Code Playgroud)
例如,我的目标是当我点击链接进入下一页时/parent/child2,
但这不会发生。当我点击链接时,它会重新打开同一个父页面。
我正在尝试制作 SVG 动画,首先我在 Adobe illustrator 中绘制动画,然后获取代码并使用 Anime.js 为其制作动画。
我仅对 SVG 中的“d”属性进行动画处理(更改)。我遇到了与我遵循的教程中的问题相同的问题:
似乎我的 SVG 代码未正确导出,或者我对锚点做了错误的操作。
StartUpTimeline.add({
targets: morph,
d: [
{ value: 'M0,0,1,360S184,253,440,254c245,1,346,236,520,236,182,0,277-189,559-189,183,0,402,100,402,100V1Z' },
],
easing: 'easeInQuint',
duration: 1500,
})Run Code Online (Sandbox Code Playgroud)
<svg id="morph" height="100%" width="100%" viewbox="0 0 1920 1080" preserveAspectRatio="none">
<path class="morph" fill="#002e3a"
d="M0,0H1S184-1,440,0C685,1,786,0,960,0c182,0,246,1,528,1h433Z"/>
</svg>Run Code Online (Sandbox Code Playgroud)
我正在尝试使用 nuxt-I18n 模块进行本地化。我已经安装"nuxt-i18n": "^6.4.1"
同样在我的 nuxt.config.js 我有休耕
modules: [
[
'nuxt-i18n',
{
defaultLocale: 'en',
lazy: true,
langDir: 'locales/',
locales: [
{
code: 'mk',
name: '??????????',
file: 'mk.js',
},
{
code: 'en',
name: 'English',
file: 'en.js',
},
],
},
],
],
Run Code Online (Sandbox Code Playgroud)
我还创建了文件夹语言环境,其中有 2 个文件,我在其中编写本地化。我项目中的大部分文本都很简单,所以我在这个设置上做得很好。但是我最终遇到了问题。我有一个文本段落,里面有一个链接,内容如下:
<p>Lorem ipsum <a href="#"> This is link </a> dolor sit amet. </p>
Run Code Online (Sandbox Code Playgroud)
我试图用 i18n 的组件来解决这个问题,但我有很多错误。
谁能给我一个如何解决这个问题的例子?
我有一个 Nuxt.js 项目,在其中尝试使用qrcode-scanner 库, 我按照步骤进行全局注册。
我在插件文件夹中创建了一个js文件并添加以下代码
import Vue from "vue";
import VueQrcodeReader from "vue-qrcode-reader";
Vue.use(VueQrcodeReader);
Run Code Online (Sandbox Code Playgroud)
它看起来很简单,但我的应用程序崩溃并且从未加载。有人遇到过这个问题吗?