Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to introduce plug-ins into vuejs

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces vuejs how to introduce plug-ins, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Introduction method: 1. Use import and "Vue.use (..)" in "main.js" Statement; 2, add "import 'path" statement within the script tag of vue file; 3, use import and "components: {}" statements in "app.vue", and so on.

The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.

Step 1: install, manual download, custom plug-in, URL access

For general vue or js plug-ins, you can usually install directly and then move on to the next step. However, it does not rule out the failure of install for various reasons and needs to be downloaded manually. There are also custom plug-ins.

Step 2: introduce plug-ins

Global introduction of js

Main.js files add

Import Loading from'. / components/loading'Vue.use (Loading)

Js was introduced separately.

Added within the script tag of vue file

Import'.. / components/loading/index.js'

Global introduction of vue

Vue is generally reintroduced by importing js, so it is introduced in the same way as js. However, there are special cases, such as the introduction of the navigation bar, which is directly introduced by vue, and the global is added in app.vue.

Import Header from'. / components/Header'components: {Header}

Vue was introduced separately.

Separate introduction is also the addition of the above code

Direct introduction

1, add in the index.html of the project

2in the configuration file of webpack. Base.conf.js, set the external extension (externals property)

Externals: {'BaiduMap':' BMap'}

Modular introduction

Introduced globally with js, this section requires that the plug-in can be installed or downloaded

Thank you for reading this article carefully. I hope the article "how to introduce plug-ins in vuejs" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report