11# Industrial-ui Vue adaptation
22
3- ## Installation
3+ ## Usage
4+
5+ ### 1. UNPKG
6+
7+ You can install Industrial-ui straight into plain HTML file:
8+
9+ ``` html
10+ <!DOCTYPE html>
11+ <html >
12+ <head >
13+ <!-- Import your styles -->
14+ <link href =" https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel =" stylesheet" >
15+ </head >
16+ <body >
17+ <div id =" app" >
18+ <iui-button >Hello, world!</iui-button >
19+ </div >
20+ </body >
21+ <!-- Import Vue -->
22+ <script src =" https://unpkg.com/vue/dist/vue.js" ></script >
423
24+ <!--
25+ Create Industrial-ui configuration.
26+ It is important to have exactly IuiConfig variable name!
27+ -->
28+ <script >
29+ const IuiConfig = {
30+ globalClass: ' ' ,
31+ components: { ... },
32+ },
33+ };
34+ </script >
35+
36+ <!-- Import industrial-ui-vue and register as a Vue plugin -->
37+ <script src =" https://unpkg.com/industrial-ui-vue" ></script >
38+
39+ <!-- Initialize Vue app -->
40+ <script >
41+ new Vue ({
42+ el: ' #app' ,
43+ })
44+ </script >
45+ </html >
46+ ```
47+
48+ ### NPM
49+
50+ Firstly, install the library itself
551``` bash
652npm i industrial-ui-vue
753```
854
9- ## Usage
55+ ** 3. With local imports (recommended)**
56+
57+ You need to register the Industrial-ui plugin that would expose the
58+ $iui instance into Vue virtual machine. Create config file and install
59+ the plugin into the Vue entry:
1060
11- Firstly, install the IUI plugin with your [ configuration] ( https://industrial-ui.com/docs/configuration ) .
12- For this, go to the main vue file and do:
1361``` js
1462import Vue from ' vue' ;
1563import config from ' ./config' ;
16- import { iui } from ' industrial-ui-vue' ;
64+ import {iui } from ' industrial-ui-vue' ;
1765
1866Vue .use (iui, config);
1967```
2068
21- Now, you are ready to use components inside the app:
22-
69+ In any template file, you can now directly import needed components
70+ and use them as you like:
71+
2372``` html
2473<template >
2574 <Dropdown >
@@ -31,9 +80,37 @@ Now, you are ready to use components inside the app:
3180</template >
3281
3382<script >
34- import { Dropdown , Button } from ' industrial-ui-vue' ;
35- export default {
36- components: { Dropdown, Button },
37- };
83+ import { IuiDropdown as Dropdown , IuiButton as Button } from ' industrial-ui-vue' ;
84+ export default {
85+ components: { Dropdown, Button },
86+ };
3887 </script >
88+ ```
89+
90+ ** 3. As a global plugin**
91+
92+ In this case, Industrial-ui would be registered globally,
93+ and all components will be imported at once.
94+
95+ Install the IUI plugin with your [ configuration] ( https://industrial-ui.com/docs/configuration ) .
96+ Go to the main vue file and do:
97+ ``` js
98+ import Vue from ' vue' ;
99+ import config from ' ./config' ;
100+ import iui from ' industrial-ui-vue' ;
101+
102+ Vue .use (iui, config);
103+ ```
104+
105+ Now, you are ready to use components inside the app:
106+
107+ ``` html
108+ <template >
109+ <iui-dropdown >
110+ <template #trigger >
111+ <iui-button >Click on me</iui-button >
112+ </template >
113+ Hello, world!
114+ </iui-dropdown >
115+ </template >
39116```
0 commit comments