Commit bd596e7add8c89d741202be16548486d8885c43c

Authored by huixisheng
1 parent a804d608

support Steps

fixed npm run dev error with  cann't find module vue-template-compiler
update test demo style
:
build/webpack.dev.config.js
... ... @@ -4,7 +4,7 @@
4 4  
5 5 var path = require('path');
6 6 var webpack = require('webpack');
7   -var ExtractTextPlugin = require('extract-text-webpack-plugin');
  7 +// var ExtractTextPlugin = require('extract-text-webpack-plugin');
8 8 var HtmlWebpackPlugin = require('html-webpack-plugin');
9 9  
10 10 module.exports = {
... ...
package.json
... ... @@ -76,6 +76,7 @@
76 76 "vue-loader": "^11.0.0",
77 77 "vue-router": "^2.2.1",
78 78 "vue-style-loader": "^1.0.0",
  79 + "vue-template-compiler": "^2.2.1",
79 80 "webpack": "^2.2.1",
80 81 "webpack-dev-server": "^2.4.1"
81 82 }
... ...
src/components/steps/step.vue
... ... @@ -21,11 +21,11 @@
21 21  
22 22 export default {
23 23 props: {
24   - status: {
25   - validator (value) {
26   - return oneOf(value, ['wait', 'process', 'finish', 'error']);
27   - }
28   - },
  24 + // status: {
  25 + // validator (value) {
  26 + // return oneOf(value, ['wait', 'process', 'finish', 'error']);
  27 + // }
  28 + // },
29 29 title: {
30 30 type: String,
31 31 default: ''
... ... @@ -42,7 +42,8 @@
42 42 prefixCls: prefixCls,
43 43 stepNumber: '',
44 44 nextError: false,
45   - total: 1
  45 + total: 1,
  46 + status: ''
46 47 };
47 48 },
48 49 computed: {
... ...
src/components/steps/steps.vue
... ... @@ -43,7 +43,7 @@
43 43 ];
44 44 }
45 45 },
46   - ready () {
  46 + mounted () {
47 47 this.updateChildProps(true);
48 48 this.setNextError();
49 49 this.updateCurrent(true);
... ...
src/index.js
... ... @@ -31,7 +31,7 @@ import Radio from './components/radio';
31 31 // import Rate from './components/rate';
32 32 // import Slider from './components/slider';
33 33 // import Spin from './components/spin';
34   -// import Steps from './components/steps';
  34 +import Steps from './components/steps';
35 35 // import Switch from './components/switch';
36 36 // import Table from './components/table';
37 37 // import Tabs from './components/tabs';
... ... @@ -96,8 +96,8 @@ const iview = {
96 96 // iSelect: Select,
97 97 // Slider,
98 98 // Spin,
99   - // Step: Steps.Step,
100   - // Steps,
  99 + Step: Steps.Step,
  100 + Steps,
101 101 // Switch,
102 102 // iTable: Table,
103 103 // Tabs: Tabs,
... ...
test/app.vue
... ... @@ -2,26 +2,15 @@
2 2 @import "../src/styles/index.less";
3 3 </style>
4 4 <style scoped>
5   -nav {
6   - margin-bottom: 40px;
7   -}
8   -
9   -li {
10   - display: inline-block;
11   -}
12   -
13   -li + li {
14   - border-left: solid 1px #bbb;
15   - padding-left: 5px;
16   - margin-left: 5px;
17   -}
18   -
19   -.v-link-active {
20   - color: #bbb;
21   -}
  5 +nav { margin-bottom: 40px; }
  6 +ul { display: flex; flex-wrap: wrap; }
  7 +li { display: inline-block; }
  8 +li + li { border-left: solid 1px #bbb; padding-left: 10px; margin-left: 10px; }
  9 +.container{ padding: 10px 40px; }
  10 +.v-link-active { color: #bbb; }
22 11 </style>
23 12 <template>
24   - <div>
  13 + <div class="container">
25 14 <nav>
26 15 <ul>
27 16 <li><router-link to="/affix">Affix</router-link></li>
... ... @@ -30,6 +19,7 @@ li + li {
30 19 <li><router-link to="/input">Input</router-link></li>
31 20 <li><router-link to="/radio">Radio</router-link></li>
32 21 <li><router-link to="/checkbox">Checkbox</router-link></li>
  22 + <li><router-link to="/steps">Steps</router-link></li>
33 23 </ul>
34 24 </nav>
35 25 <router-view></router-view>
... ...
test/main.js
... ... @@ -40,6 +40,10 @@ const router = new VueRouter({
40 40 {
41 41 path: '/checkbox',
42 42 component: require('./routers/checkbox.vue')
  43 + },
  44 + {
  45 + path: '/steps',
  46 + component: require('./routers/steps.vue')
43 47 }
44 48 ]
45 49 });
... ...
test/routers/step.vue renamed to test/routers/steps.vue
1   -<style>
2   -
3   -</style>
4 1 <template>
  2 +<div>
5 3 <Steps :current="1" size="small">
6 4 <Step title="已完成" content="这里是该步骤的描述信息这里是该步骤的描述信息这里是该步骤的描述信息"></Step>
7 5 <Step title="进行中" content="这里是该步骤的描述信息"></Step>
... ... @@ -41,8 +39,9 @@
41 39 <Step title="步骤3"></Step>
42 40 <Step title="步骤4"></Step>
43 41 </Steps>
44   - <i-button type="primary" @click="next">下一步</i-button>
45   - <br><br>
  42 + <br>
  43 + <Button type="primary" @click.native="next">下一步</Button>
  44 + <br><br><br>
46 45 <Steps :current="1" direction="vertical" size="small">
47 46 <Step title="已完成" content="这里是该步骤的描述信息这里是该步骤的描述信息这里是该步骤的描述信息"></Step>
48 47 <Step title="进行中" content="这里是该步骤的描述信息"></Step>
... ... @@ -56,18 +55,18 @@
56 55 <Step title="待进行" content="这里是该步骤的描述信息"></Step>
57 56 <Step title="待进行" content="这里是该步骤的描述信息"></Step>
58 57 </Steps>
  58 +</div>
59 59 </template>
60 60 <script>
61   - import { Page, Steps, iButton } from 'iview';
  61 + import { Steps, Button } from 'iview';
62 62  
63 63 const Step = Steps.Step;
64 64  
65 65 export default {
66 66 components: {
67   - Page,
68 67 Steps,
69 68 Step,
70   - iButton
  69 + Button
71 70 },
72 71 props: {
73 72  
... ... @@ -82,9 +81,6 @@
82 81  
83 82 },
84 83 methods: {
85   - setPage (page) {
86   - console.log(page)
87   - },
88 84 next () {
89 85 if (this.current == 3) {
90 86 this.current = 0;
... ...