Vue + Element-ui + jQuery binding Code

The current environment

Npm exists
already installed node (check the version: node -v)
has a global installed vue-cli (check for successful installation vue --version)

Vue installation

Open small blackboard (Ctril + R input Enter cmd)
small blackboard entries in the "#" is interpreted later than typing numbers
into the folder switching (direct disk "c:", in the file into the disk space + CD + file name)

npm install --global vue-cli		#全局安装vue-cli (如果已经安装,就不要在安装了,不然会出错4058,所以在第一次安装后,以后再用init创建项目的时候就不用安装vue-cli了)

vue init webpack name		#name是自己自定义的文件夹名字。(这里会有漫长的等待)

name #除了第一个Project name 后面输入你的文件名外,其余的直接enter即可,进入等待…

cd name  #进入文件夹内

cnpm install
npm run dev	#运行后自己从浏览器打开网址,有时候会自己默认打开,算了,这不重要

At this time, vue project is loaded, and start down the introduction of Element-ui

The introduction of Element-ui

Small blackboard

npm i element-ui -S

Incorporated src / main.js in

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(ElementUI)

It is like this
ElementUI incorporated src / main.js in

The introduction of jQuery

npm install jquery --save-dev

Applied to the build / webpack.base.conf.js in

var webpack = require("webpack") 

And finally add in the module.exports

plugins: [
	new webpack.optimize.CommonsChunkPlugin('common.js'),
	new webpack.ProvidePlugin({
		jQuery: "jquery",
		$: "jquery"
	})
]

Finally src / main.js Canada

import $ from 'jquery'

Then on ok

Guess you like

Origin blog.csdn.net/qq_39394518/article/details/87636572