element/examples/docs/en-US/installation.md

54 lines
1.4 KiB
Markdown
Raw Normal View History

2016-11-13 03:58:45 +00:00
## Installation
2016-10-28 03:52:43 +00:00
2016-11-13 03:58:45 +00:00
### npm
2016-11-26 21:42:33 +00:00
Installing with npm is recommended and it works seamlessly with [webpack](https://webpack.js.org/).
2016-10-28 03:52:43 +00:00
```shell
2016-11-13 03:58:45 +00:00
npm i element-ui -D
2016-10-28 03:52:43 +00:00
```
### CDN
2016-11-13 03:58:45 +00:00
Get the latest version from [unpkg.com/element-ui](https://unpkg.com/element-ui/) , and import JavaScript and CSS file in your page.
2016-10-28 03:52:43 +00:00
```html
2016-11-13 03:58:45 +00:00
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-default/index.css">
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
2016-10-28 03:52:43 +00:00
```
### Hello world
2016-11-13 03:58:45 +00:00
If you are using CDN, a hello-world page is easy with Element. [Online Demo](http://codepen.io/QingWei-Li/pen/vXwJrY)
2016-10-28 03:52:43 +00:00
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
2016-11-13 03:58:45 +00:00
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-default/index.css">
2016-10-28 03:52:43 +00:00
</head>
<body>
<div id="app">
2016-11-20 14:39:33 +00:00
<el-button @click="visible = true">Button</el-button>
2016-10-28 03:52:43 +00:00
<el-dialog v-model="visible" title="Hello world">
2016-11-13 03:58:45 +00:00
<p>Try Element</p>
2016-10-28 03:52:43 +00:00
</el-dialog>
</div>
</body>
2016-11-16 12:06:02 +00:00
<!-- import Vue before Element -->
2016-11-13 03:58:45 +00:00
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
2016-10-28 03:52:43 +00:00
<script>
new Vue({
el: '#app',
data: function() {
return { visible: false }
}
})
</script>
</html>
```
2016-11-26 21:42:33 +00:00
If you are using npm and wish to apply webpack, please continue to the next page: Quick Start.