File tree Expand file tree Collapse file tree 5 files changed +19
-17
lines changed
samples/vuejs/typescript/00 Custom Validator Expand file tree Collapse file tree 5 files changed +19
-17
lines changed Original file line number Diff line number Diff line change 3737 "file-loader" : " ^0.11.1" ,
3838 "html-webpack-plugin" : " ^2.28.0" ,
3939 "style-loader" : " ^0.16.1" ,
40- "typescript" : " ^ 2.2.2" ,
40+ "typescript" : " 2.2.2" ,
4141 "url-loader" : " ^0.5.8" ,
4242 "webpack" : " ^2.3.3" ,
4343 "webpack-dev-server" : " ^2.4.2"
4444 },
4545 "dependencies" : {
4646 "bootstrap" : " ^3.3.7" ,
47- "lc-form-validation" : " ^1.0.0 " ,
48- "vue" : " ^ 2.2.6" ,
49- "vue-router" : " ^ 2.4.0"
47+ "lc-form-validation" : " file:../../../../lib/ " ,
48+ "vue" : " 2.2.6" ,
49+ "vue-router" : " 2.4.0"
5050 }
5151}
Original file line number Diff line number Diff line change 1- import Vue , { ComponentOptions } from 'vue' ;
1+ import Vue , { ComponentOptions } from 'vue' ;
22
33interface Props extends Vue {
44 hasError : boolean ;
@@ -15,7 +15,7 @@ export const ValidationComponent = Vue.extend({
1515 render : function ( h ) {
1616 let wrapperClass = `${ this . className } ` ;
1717
18- if ( this . hasError ) {
18+ if ( this . hasError ) {
1919 wrapperClass = `${ wrapperClass } has-error`
2020 }
2121
@@ -28,4 +28,4 @@ export const ValidationComponent = Vue.extend({
2828 </ div >
2929 ) ;
3030 } ,
31- } as ComponentOptions < Props > ) ;
31+ } as ComponentOptions < Props > ) ;
Original file line number Diff line number Diff line change @@ -90,4 +90,4 @@ export const FormComponent = Vue.extend({
9090 </ form >
9191 ) ;
9292 } ,
93- } as ComponentOptions < FormComponentOptions > ) ;
93+ } as ComponentOptions < FormComponentOptions > ) ;
Original file line number Diff line number Diff line change 1- import Vue , { ComponentOptions } from 'vue' ;
2- import { RecipeEntity , RecipeError } from '../../../model' ;
3- import { recipeAPI } from '../../../api/recipe' ;
4- import { editFormValidation } from './validations/editFormValidation' ;
5- import { EditRecipePage } from './page' ;
1+ import Vue , { ComponentOptions } from 'vue' ;
2+ import { RecipeEntity , RecipeError } from '../../../model' ;
3+ import { recipeAPI } from '../../../api/recipe' ;
4+ import { editFormValidation } from './validations/editFormValidation' ;
5+ import { EditRecipePage } from './page' ;
66
77interface EditRecipeContainerOptions extends Vue {
88 recipe : RecipeEntity ;
@@ -84,10 +84,12 @@ export const EditRecipeContainer = Vue.extend({
8484 save : function ( ) {
8585 editFormValidation . validateForm ( this . recipe )
8686 . then ( ( result ) => {
87- result . fieldErrors
88- . map ( ( error ) => this . updateRecipeError ( error . key , error ) ) ;
87+ this . recipeError = {
88+ ...this . recipeError ,
89+ ...result . fieldErrors ,
90+ } ;
8991
90- if ( result . succeeded ) {
92+ if ( result . succeeded ) {
9193 console . log ( 'Save recipe' ) ;
9294 }
9395 } ) ;
Original file line number Diff line number Diff line change 1818 "exclude" : [
1919 " node_modules"
2020 ]
21- }
21+ }
You can’t perform that action at this time.
0 commit comments