next. js_Next.js添加到您的应用程序中的图标

next. js

When working on a Next.js app, do you see that little icon at the bottom right of the page, which looks like a lightning?

在使用Next.js应用程序时,您是否在页面右下方看到一个小图标,看起来像闪电?

If you hover it, it’s going to say “Prerendered page”:

如果将其悬停,它将显示“ Prerendered page”:

This icon, which is only visible in development mode of course, tells you the page qualifies for automatic static optimization, which basically means that it does not depend on data that needs to be fetched at invokation time, and it can be prerendered and built as a static HTML file at build time (when we run npm run build).

该图标( 仅在开发模式下才可见)告诉您该页面符合自动静态优化的条件,这基本上意味着该页面不依赖于在调用时需要获取的数据,并且可以按以下方式进行预渲染和构建:在构建时(当我们运行npm run build )的静态HTML文件。

Next can determine this by the absence of the getInitialProps() method attached to the page component.

Next可以通过缺少附加到页面组件的getInitialProps()方法来确定这一点。

When this is the case, our page can be even faster because it will be served statically as an HTML file rather than going through the Node.js server that generates the HTML output.

在这种情况下,我们的页面甚至可以更快,因为它将作为HTML文件静态提供,而不是通过生成HTML输出的Node.js服务器提供。

Another useful icon that might appear next to it, or instead of it on non-prerended pages, is a little animated triangle:

可能会出现在它旁边的另一个有用图标,或者代替它出现在非优先页面上的是一个动画三角形:

This is a compilation indicator, and appears when you save a page and Next.js is compiling the application before hot code reloading kicks in to reload the code in the application automatically.

这是一个编译指示符,当您保存页面并且Next.js正在编译应用程序之前,此提示会在热代码重新加载开始之前自动显示在应用程序中。

It’s a really nice way to immediately determine if the app has already been compiled and you can test a part of it you’re working on.

这是一种非常好的方法,可以立即确定该应用程序是否已被编译,并且您可以测试正在处理的应用程序的一部分。

翻译自: https://flaviocopes.com/nextjs-bottom-icon/

next. js

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[1\]提供了一个配置Vue3项目的main.js的示例代码。在这个示例,首先需要安装Element Plus的图标库,然后在main.js引入并配置这些图标。接下来,需要安装Vue Router和Vuex,并在main.js引入和配置它们。最后,使用createApp函数创建Vue实例,并通过use方法挂载路由、状态管理和Element Plus插件。 引用\[2\]提供了一个关于配置Vue3项目的main.js的顺序和注意事项。在这个示例,首先需要按照顺序依次引入和配置路由、状态管理和Element Plus插件。注意,顺序不能乱,否则可能会导致报错。 根据以上引用内容,可以得出Vue3的main.js配置的步骤如下: 1. 安装Element Plus的图标库:npm install @element-plus/icons-vue 2. 在main.js引入并配置Element Plus的图标库,示例代码如下: ```javascript import * as ElementPlusIconsVue from '@element-plus/icons-vue' const app = createApp(App) for (const \[key, component\] of Object.entries(ElementPlusIconsVue)) { app.component(key, component) } ``` 3. 安装Vue Router:npm install vue-router@4 4. 安装Vuex:npm install vuex@next --save 5. 在main.js引入并配置Vue Router和Vuex,示例代码如下: ```javascript import { createApp } from 'vue' import App from './App.vue' import router from './router/index' import store from './store/index' const app = createApp(App) app.use(router).use(store) ``` 6. 引入并配置Element Plus插件,示例代码如下: ```javascript import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' app.use(ElementPlus) ``` 7. 最后,使用mount方法将Vue实例挂载到DOM元素上,示例代码如下: ```javascript app.mount('#app') ``` 请注意,以上步骤仅为示例,实际配置可能会根据项目需求有所不同。 #### 引用[.reference_title] - *1* *2* [Vue3创建项目(四)main.js配置,避坑指南](https://blog.csdn.net/zhangxueyou2223/article/details/128144109)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [vue3在main.js里面定义全局函数,然后其他页面使用](https://blog.csdn.net/qq_33769914/article/details/126101917)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值