mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-05 14:20:25 +08:00
34 lines
729 B
JavaScript
34 lines
729 B
JavaScript
|
|
Vue.component("datepicker", {
|
||
|
|
props: ["v-name", "v-value", "v-bottom-left"],
|
||
|
|
mounted: function () {
|
||
|
|
let that = this
|
||
|
|
teaweb.datepicker(this.$refs.dayInput, function (v) {
|
||
|
|
that.day = v
|
||
|
|
that.change()
|
||
|
|
}, !!this.vBottomLeft)
|
||
|
|
},
|
||
|
|
data: function () {
|
||
|
|
let name = this.vName
|
||
|
|
if (name == null) {
|
||
|
|
name = "day"
|
||
|
|
}
|
||
|
|
|
||
|
|
let day = this.vValue
|
||
|
|
if (day == null) {
|
||
|
|
day = ""
|
||
|
|
}
|
||
|
|
|
||
|
|
return {
|
||
|
|
name: name,
|
||
|
|
day: day
|
||
|
|
}
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
change: function () {
|
||
|
|
this.$emit("change", this.day)
|
||
|
|
}
|
||
|
|
},
|
||
|
|
template: `<div style="display: inline-block">
|
||
|
|
<input type="text" :name="name" v-model="day" placeholder="YYYY-MM-DD" style="width:8.6em" maxlength="10" @input="change" ref="dayInput" autocomplete="off"/>
|
||
|
|
</div>`
|
||
|
|
})
|