[new feature] Dialog: support component call (#593)

This commit is contained in:
neverland
2018-01-31 11:22:00 +08:00
committed by GitHub
parent 9df66da212
commit aa4f03a15d
11 changed files with 211 additions and 53 deletions

View File

@@ -8,6 +8,26 @@
<demo-block :title="$t('title2')">
<van-button @click="onClickConfirm">Confirm</van-button>
</demo-block>
<demo-block :title="$t('advancedUsage')">
<van-button @click="show = true">{{ $t('advancedUsage') }}</van-button>
<van-dialog
v-model="show"
@confirm="show = false"
>
<van-field
v-model="username"
:label="$t('username')"
:placeholder="$t('usernamePlaceholder')"
/>
<van-field
v-model="password"
type="password"
:label="$t('password')"
:placeholder="$t('passwordPlaceholder')"
/>
</van-dialog>
</demo-block>
</demo-section>
</template>
@@ -26,6 +46,14 @@ export default {
}
},
data() {
return {
show: false,
username: '',
password: ''
};
},
methods: {
onClickAlert() {
Dialog.alert({
@@ -52,7 +80,7 @@ export default {
<style lang="postcss">
.demo-dialog {
.van-button {
.van-doc-demo-block > .van-button {
margin: 15px;
}
}

View File

@@ -68,13 +68,9 @@ export default {
title3: '禁用输入框',
title4: '错误提示',
title5: '高度自适应',
username: '用户名',
password: '密码',
message: '留言',
phone: '手机号',
phonePlaceholder: '请输入手机号',
usernamePlaceholder: '请输入用户名',
passwordPlaceholder: '请输入密码',
messagePlaceholder: '请输入留言',
inputDisabled: '输入框已禁用',
phoneError: '手机号格式错误'
@@ -84,13 +80,9 @@ export default {
title3: 'Disabled',
title4: 'Error info',
title5: 'Auto resize',
username: 'Username',
password: 'Password',
message: 'Message',
phone: 'Phone',
phonePlaceholder: 'Phone',
usernamePlaceholder: 'Username',
passwordPlaceholder: 'Password',
messagePlaceholder: 'Message',
inputDisabled: 'Disabled',
phoneError: 'Invalid phone'