Skip to content

Commit 4beb01b

Browse files
committed
add coerce function
1 parent 8f1aa27 commit 4beb01b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/guide/components.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,13 @@ Vue.component('example', {
317317
validator: function (value) {
318318
return value > 10
319319
}
320+
},
321+
// coerce function (new in 1.0.12)
322+
// cast the value before setting it on the component
323+
propG: {
324+
coerce: function (val) {
325+
return val + '' // cast the value to string
326+
}
320327
}
321328
}
322329
})

0 commit comments

Comments
 (0)