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