


Installation tutorial for using vue and element components (detailed tutorial)
Below I will share with you an article on the installation of vue and the installation of element components. It has a good reference value and I hope it will be helpful to everyone.
1. Create a new vue project
1. First, you need to download nodejs. After installation, open the command window and use the npm package management tool
npm is integrated in node, so directly enter npm-v to view the version information of npm
2. npm has some resources Being blocked or due to foreign resources often results in failure when installing dependent packages using npm, so I also need npm's domestic mirror ---cnpm.
3. Enter npm install -g cnpm--registry=http://registry.npm.taobao.org in the command line and wait for the installation to complete. You can use cnpm to install dependency packages. Let’s talk about it here. It is best to use npm to install. Sometimes cnpm's dependencies are not fully downloaded. If npm downloads slowly, you can try cnpm to install dependency packages.
4. Install the vue-cli scaffolding building tool. Run the command npm install -g vue-cli on the command line and wait for the installation to complete.
5. Build the project with vue-cli. Select a directory to store the new project
#6. In the desktop directory, run the command vue init webpack firstVue on the command line. Explain this command. This command means to initialize a project, where webpack is the build tool, that is, the entire project is based on webpack. where firstVue is the name of the entire project folder.
7. When running the initialization command, the user will be asked to enter several basic options, such as project name, description, author and other information. If you do not want to fill in the fields, just press Enter and default. good.
8. Open the firstVue folder. The project file is as follows.
9. Install the dependency package (remember it must be in the newly created project folder), use the npm install command
10. Install the dependency After that, run the project and implement it through npm run dev. Generally, the default is port 8080. Open the browser and enter localhost:8080
# displays like this:
2. The following introduces Element
1. In the current directory, run: npm i element-ui -S2. Add the code (red)
// The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. import Vue from 'vue' import App from './App' import router from './router' import ElementUI from 'element-ui' //手动变红 import '../node_modules/element-ui/lib/theme-chalk/index.css' //手动变红 //具体路径有的不同,vue运行报错请看第五点 Vue.config.productionTip = false /* eslint-disable no-new */ Vue.use(ElementUI) //手动变红 new Vue({ el: '#app', router, template: '<App/>', components: { App } })3 in src/main.js, and then you can use it directly in the .vue file For example: make some changes in src/components/Hello.vue
<template> <p class="hello"> <h1 id="nbsp-msg-nbsp">{{ msg }}</h1> <h2 id="Essential-nbsp-Links">Essential Links</h2> <el-button>默认按钮</el-button> <el-button type="primary">主要按钮</el-button> <el-button type="text">文字按钮</el-button> </p> </template> <script> export default { name: 'hello', data () { return { msg: 'Welcome to Your Vue.js App' } } } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped> h1, h2 { font-weight: normal; } ul { list-style-type: none; padding: 0; } li { display: inline-block; margin: 0 10px; } a { color: #42b983; } </style>4. Run again
5. The above (3) will sometimes report an error. First, check whether the index.css path of element-ui is correct. Second, because the error will show that the file cannot be found, you need to build Add a piece of code to the /webpack.base.conf.js file as follows.
The above is what I compiled for you. I hope it will be helpful to everyone in the future.
Related articles:
Angular study notes: examples of integrating third-party UI frameworks and controlsNode.js implementation registration Example of how to activate the email functionDetailed explanation of Webpack’s babel-loader file preprocessorThe above is the detailed content of Installation tutorial for using vue and element components (detailed tutorial). For more information, please follow other related articles on the PHP Chinese website!

JavaScript's application in the real world includes front-end and back-end development. 1) Display front-end applications by building a TODO list application, involving DOM operations and event processing. 2) Build RESTfulAPI through Node.js and Express to demonstrate back-end applications.

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.

Understanding how JavaScript engine works internally is important to developers because it helps write more efficient code and understand performance bottlenecks and optimization strategies. 1) The engine's workflow includes three stages: parsing, compiling and execution; 2) During the execution process, the engine will perform dynamic optimization, such as inline cache and hidden classes; 3) Best practices include avoiding global variables, optimizing loops, using const and lets, and avoiding excessive use of closures.

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Dreamweaver Mac version
Visual web development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Mac version
God-level code editing software (SublimeText3)

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function