Step 1: Introduce the js file of layDate in index.html
<script src="/static/js/laydate/laydate.js"></script>
Step 2: Declare laydate: window.laydate in the calling page data
export default {
data() {
return {
submitInfo: {},
laydate: window.laydate,
};
}
}
The third step: loop call
<input class="layer_time" id="owner_contract_end" v-model="submitInfo.owner_contract_end"/>
export default {
data() {
return {
submitInfo: {},
laydate: window.laydate,
};
},
mounted: function () {
let self = this;
$(".layer_time").each(function (index) {
let id = $(this).prop("id");
self.laydate.render({
elem: "#" + id,
done: (value) => {
console.log("value", value);
self.submitInfo[id] = value;
},
});
});
}
}