当前位置:网站首页>[nuxt 3] (XI) transmission & module
[nuxt 3] (XI) transmission & module
2022-07-25 14:34:00 【choukin】
“ You people here , Five thousand roses were planted in one garden , But I can't find what I'm looking for .” ———— 《 The little prince 》
delivery
Vue 3 Built in <Teleport> Components Allow component content to be rendered to Vue Any external DOM On .
<teleport> Of to attribute , Receive one CSS Selectors , Or a real DOM node .Nuxt at present SSR Some support eating Transferred to the body, The client is going to use <ClientOnly> Support rendering to other targets after wrapping .
Example : body teleport
<template>
<button @click="open = true">
Open Modal
</button>
<Teleport to="body">
<div v-if="open" class="modal">
<p>Hello from the modal!</p>
<button @click="open = false">
Close
</button>
</div>
</Teleport>
</template>
Example : client-side teleport
<ClientOnly>
<Teleport to="#some-selector">
<!-- content -->
</Teleport>
</ClientOnly>
</template>
modular
Nuxt A module system is provided to extend the core of the framework and simplify the integration . For existing modules , You need to redevelop or maintain scaffolding , You can nuxt.config Add the module you want to use .
Explore Nuxt modular
When using Nuxt When developing production level applications , You may find that the core functions of the framework are not enough .Nuxt It can be extended through configuration options and plug-ins , But maintaining these configurations in multiple projects can be cumbersome , And repeat . On the other hand , The need to support each project out of the box will make Nuxt Become very complex and difficult to use .
This is a Nuxt One reason to provide a modular system to expand core functions .Nuxt Modules are asynchronous functions , In execution nuxi dev or nuxi build They will execute in sequence . They can replace templates , To configure webpackde loaders , add to CSS library , And perform many other useful tasks .
The best thing is ,Nuxt Modules can be accessed through npm Package management , This allows them to be reused across projects and shared with the community , Help create a high-quality add-on ecosystem .
Extended reading [1]
modules attribute
After installing the module , You can add them to nuxt.config.ts In the document modules Properties of the . The developer of the module usually provides additional operation steps and usage details .
export default defineNuxtConfig({
modules: [
// Using package name (recommended usage)
'@nuxtjs/example',
// Load a local module
'./modules/example',
// Add module with inline-options
['./modules/example', { token: '123' }]
// Inline module definition
async (inlineOptions, nuxt) => { }
]
})
Nuxt Modules are now available only at build time ,Nuxt2 in buildModules Attributes are modules To replace the .
Module development
Everyone can develop modules , stay Module development guidelines Read more about development modules .
Reference material
Nuxt 3 Compatible Modules: https://modules.nuxtjs.org/?version=3.x"
边栏推荐
- VS2017大型工厂ERP管理系统源码 工厂通用ERP源码
- 基于PaddleOCR开发uni-app离线身份证识别插件
- GameFramework制作游戏(一)
- C language and SQL Server database technology
- The concept and operation rules of calculus of variations
- sqli-labs Basic Challenges Less11-22
- gson与fastjson
- [MySQL must know and know] trigger | permission management
- 安防市场进入万亿时代,安防B2B网上商城平台精准对接深化企业发展路径
- Numpy basic package for data analysis
猜你喜欢

That day, I installed a database for my sister... Just help her sort out another shortcut

实现一个家庭安防与环境监测系统(一)
Famous handwritten note taking software recruit CTO · coordinate Shenzhen

Doris learning notes integration with other systems

The concept and operation rules of calculus of variations

~5 new solution of CCF 2021-12-2 sequence query

Vs2017 large factory ERP management system source code factory general ERP source code

Feiwo technology IPO meeting: annual revenue of 1.13 billion Hunan Cultural Tourism and Yuanli investment are shareholders

DVWA practice - brute force cracking

Niuke multi school E G J L
随机推荐
手把手教你申请SSL证书
Awk from getting started to digging in (20) awk parsing command line parameters
Feiwo technology IPO meeting: annual revenue of 1.13 billion Hunan Cultural Tourism and Yuanli investment are shareholders
Two Sum
~4.1 sword finger offer 05. replace spaces
Typora cannot open the prompt to install a new version solution
Can the variable name be in Chinese? Directly fooled people
Paddlenlp's UIE relationship extraction model [executive relationship extraction as an example]
Vs2017 large factory ERP management system source code factory general ERP source code
C language and SQL Server database technology
DVWA practice - brute force cracking
From fish eye to look around to multi task King bombing -- a review of Valeo's classic articles on visual depth estimation (from fisheyedistancenet to omnidet) (Part I)
Bond0 script
Throwing OutOfMemoryError “Could not allocate JNI Env“
Maya modeling exercise
网络安全应急响应技术实战指南(奇安信)
awk从入门到入土(24)提取指令网卡的ip
The security market has entered a trillion era, and the security B2B online mall platform has been accurately connected to deepen the enterprise development path
优质数对的数目[位运算特点+抽象能力考察+分组快速统计]
MySQL table operation