var vm = new Vue({ el: '#app', data: { lineDtos: [], machineDtos: [] }, mounted() { this.init() this.initDatepicker() }, methods: { init() { }, initDatepicker() { $("#date1").datepicker({ format: 'yyyy-mm-dd', language: "zh-CN", autoclose: true, todayBtn: "linked" }).on('keydown', function (e) { return false; }) $("#date2").datepicker({ format: 'yyyy-mm-dd', language: "zh-CN", autoclose: true, todayBtn: "linked" }).on('keydown', function (e) { return false; }) }, getEnergyConsumptionReport() { let _this = this axios .get('/EnergyConsumptionReport/GetEnergyConsumptionReport', { params: { startDate: $("#date1").val(), endDate: $("#date2").val() } }) .then(function (response) { _this.lineDtos = response.data.lineDtos; }) .catch(function (error) { console.log(error) }); } } })