Skip to content

Commit

Permalink
Merge pull request #599 from MTTTM/3.x
Browse files Browse the repository at this point in the history
up-datetime-picker日期组件支持禁用
  • Loading branch information
ijry authored Dec 30, 2024
2 parents cc85ba9 + 06b479c commit 7960456
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export const props = defineMixin({
hasInput: {
type: Boolean,
default: () => false
},
disabled: {
type: Boolean,
default: () => false
},
placeholder: {
type: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<template>
<view class="u-datetime-picker">
<view v-if="hasInput" class="u-datetime-picker__has-input"
@click="showByClickInput = !showByClickInput"
@click="onShowByClickInput"
>
<slot name="trigger" :value="inputValue">
<up-input
:placeholder="placeholder"
:readonly="!!showByClickInput"
border="surround"
v-model="inputValue"
:disabled="disabled"
></up-input>
<div class="input-cover">
</div>
Expand Down Expand Up @@ -461,6 +462,12 @@
[`${type}Hour`]: hour,
[`${type}Minute`]: minute
}
},
onShowByClickInput(){
if(!this.disabled){
this.showByClickInput = !this.showByClickInput
}
}
}
}
Expand Down

0 comments on commit 7960456

Please sign in to comment.