将laydate下载的包放入static
index.html 引入
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
<script src="static/laydate.js"></script>
</body>
在组件中使用
<template>
<div class="hello">
{{date}}
<input type="text" id="test" v-model="date">
</div>
</template>
<script>
/* eslint-disable */
export default {
name: 'hello',
data () {
return {
msg: 'Welcome to Your Vue.js App',
titleActive: false,
date: '2017-09-08 09:00:00'
}
},
mounted: function () {
console.log(laydate)
laydate.render({
elem: '#test',
type:'datetime',
done: (value) => {
this.date = value
}
})
}
</script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…