Vue2一个漂亮的日期选择组件:
仅依赖于Vue
轻量级(小于4kb的压缩包)
美观
$ npm install vue-datepicker-local
<template> <vue-datepicker-local v-model="time" /> </template> <script> import VueDatepickerLocal from 'vue-datepicker-local' export default { components: { VueDatepickerLocal }, data () { return { time: new Date() } } } </script>
dist文件夹包含了 vue -datepicker- local.js 和 vue-datepicker-local.css。
<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="path/to/vue-datepicker-local.css"> </head> <body> <div id="app"> <vue-datepicker-local v-model="time"></vue-datepicker-local> </div> <script src="path/to/vue.js"></script> <script src="path/to/vue-datepicker-local.js"></script> <script> new Vue({ el: "#app", data: { time: new Date() } }) </script> </body> </html>