Skip to content

Commit

Permalink
Add type prop for textfield.
Browse files Browse the repository at this point in the history
  • Loading branch information
furybean committed Nov 6, 2015
1 parent 09a4ab7 commit 767845c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions examples/form/field.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<d-text-field label="团队名称" :model='team' property='teamName' schema='Team'></d-text-field>
<d-text-field label="昵称" :model='team' property='nickname' schema='Team'></d-text-field>
<d-text-field label="密码" :model='team' type='password' property='password' schema='Team'></d-text-field>

<div>
<d-field label="Custom">
Expand Down Expand Up @@ -45,6 +46,9 @@
},
nickname: {
required: true
},
password: {
},
sex: {},
category: {},
Expand Down
7 changes: 6 additions & 1 deletion src/form/fields/text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
},
hintMessage: {
type: String
},
type: {
type: String,
default: 'text'
}
},
Expand All @@ -51,7 +55,8 @@
created() {
var parent = this.$parent;
var bindProperty = '$parent.model.' + parent.property;
this.$options.template = `<d-text-editor type="text" :value.sync="${ bindProperty }" />`;
var type = parent.type;
this.$options.template = `<d-text-editor type="${type}" :value.sync="${ bindProperty }" />`;
}
}
},
Expand Down

0 comments on commit 767845c

Please sign in to comment.