This time I will bring you the configuration mint-ui of Vue2.0 from scratch (with code). What are the precautions for configuring mint-ui of Vue2.0 from scratch? The following is a practical case, let's take a look.
Recently, I have gradually adopted the vue.js mint-ui technology stack when developing projects. However, when I started configuring the development environment yesterday, I encountered various errors. Even if I configured it according to the official documents of the two companies, it still failed. An error would be reported, and I went back to configure it after get off work all night before finally configuring it, so I recorded it to prevent it from happening again later. .
Introduction to vue.js
Vue.js is a tool for creating web interactive interfaces. Its characteristics are
Concise HTML template JSON data, and then create a Vue instance, it's that simple.
Data-driven Automatically track dependent template expressions and calculated properties.
Componentization uses decoupled and reusable components to construct the interface.
Lightweight ~24kb min gzip, no dependencies.
Fast, precise and effective asynchronous batch DOM updates.
Module Friendly Install via NPM or Bower and integrate seamlessly into your workflow.
vue.js Chinese official website
mint-ui introduction
Mint UI is based on the open source of the Ele.me front-end team The
features of Vue.js’s mobile component library are:
Mint UI contains rich CSS and JS components, which can meet daily mobile development needs. Through it, you can quickly build a page with a unified style and improve development efficiency.
True loading of components on demand. You can load only the declared components and their style files, without worrying about the file size being too large.
Taking into account the performance threshold of the mobile terminal, Mint UI uses CSS3 to handle various animations to avoid unnecessary redrawing and rearrangement of the browser, so that users can get a smooth experience. experience.
Relying on Vue.js’ efficient componentization solution, Mint UI is lightweight. Even if all are imported, the compressed file size is only ~30kb (JS CSS) gzip.
Mint UI Chinese official website
Create Vue.js project
First create it locally according to the method given by vue official website A vue project
# 全局安装 vue-cli $ npm install --global vue-cli # 创建一个基于 webpack 模板的新项目 $ vue init webpack my-project # 安装依赖,走你 $ cd my-project $ npm install $ npm run dev
Configuring the Mint UI environment
Then introduce the Mint UI environment into the project according to the official website of Mint UI
npm i mint-ui -S
Then in the project The main.js file in introduces all components
import Vue from 'vue' import MintUI from 'mint-ui' import 'mint-ui/lib/style.css' import App from './App.vue' Vue.use(MintUI)
Okay, according to the official website, the above code completes the introduction of Mint UI.
Run the project
Finally, write a button component in APP.vue according to the content of the official website and take a look
<template> <p> <mt-button>按钮</mt-button> </p> </template> <script> export default{ el: '#app', methods: { handleClick: function() { this.$toast('Hello world!'); } } } </script> <style> </style>
Okay, the environment is set up. Let’s run the project
npm run dev
and then report various errors
solve the errors
First You need to install the CSS interpreter in your local project
npm i css-loader style-loader -D
and then webpack.base.conf under the build folder. The following code is configured in the js file
{ test: /\.css$/, include: [ /src/, '/node_modules/mint-ui/lib/' ], use:[ {loader:"style-loader"}, {loader:"css-loader"}, ] }
If you report an error such as es2015, you need to modify the .babelrc file to:
{ "presets": [ ["es2015", { "modules": false }] ], "plugins": [["component", [ { "libraryName": "mint-ui", "style": true } ]]] }
Finally run
After the environment is configured, we finally run it.
npm run dev
Finally it’s done. At this point, the environment configuration is completed.
# I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
vue router dynamic routing operation sub-routing
How to use vue webpack to make asynchronous loading
The above is the detailed content of Vue2.0 configuration mint-ui from scratch (with code). For more information, please follow other related articles on the PHP Chinese website!

JavaScript is widely used in websites, mobile applications, desktop applications and server-side programming. 1) In website development, JavaScript operates DOM together with HTML and CSS to achieve dynamic effects and supports frameworks such as jQuery and React. 2) Through ReactNative and Ionic, JavaScript is used to develop cross-platform mobile applications. 3) The Electron framework enables JavaScript to build desktop applications. 4) Node.js allows JavaScript to run on the server side and supports high concurrent requests.

Python is more suitable for data science and automation, while JavaScript is more suitable for front-end and full-stack development. 1. Python performs well in data science and machine learning, using libraries such as NumPy and Pandas for data processing and modeling. 2. Python is concise and efficient in automation and scripting. 3. JavaScript is indispensable in front-end development and is used to build dynamic web pages and single-page applications. 4. JavaScript plays a role in back-end development through Node.js and supports full-stack development.

C and C play a vital role in the JavaScript engine, mainly used to implement interpreters and JIT compilers. 1) C is used to parse JavaScript source code and generate an abstract syntax tree. 2) C is responsible for generating and executing bytecode. 3) C implements the JIT compiler, optimizes and compiles hot-spot code at runtime, and significantly improves the execution efficiency of JavaScript.

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.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools