Home > Article > Web Front-end > Detailed explanation of the steps to configure mint-ui in Vue2.0
This time I will bring you a detailed explanation of the steps to configure mint-ui in Vue2.0. What are the precautions for configuring mint-ui in Vue2.0? 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 startedconfiguring the development environment yesterday, I encountered various errors, even if I followed the two companies’ The official document configuration will still report errors. 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 areexpressions and calculated properties.
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: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 UInpm i mint-ui -SThen 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 id="app"> <mt-button @click.native="handleClick">按钮</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 devand then report various errors
solve the errors
First You need to install the CSS interpreter in your local projectnpm i css-loader style-loader -D
{ 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
How to get the position of DOM elements in JS
Detailed explanation of jQuery ajax dynamic operation form tr td steps
What should Vue pay attention to in front-end development
The above is the detailed content of Detailed explanation of the steps to configure mint-ui in Vue2.0. For more information, please follow other related articles on the PHP Chinese website!