Time control to select Vue development --ElementUI of (year, month, day, hour)

Note:
the format = "the MM-dd-YYYY hh: mm"
value-the format = "the MM-dd-YYYY hh: mm"
Here hh: mm time is 12 hour, HH: mm refers to the 24-hour system.

<html>
<head>
    <title>测试</title>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
   <el-date-picker
      v-model="value1"
      type="datetime"
      format="yyyy-MM-dd hh:mm"
      value-format="yyyy-MM-dd hh:mm"
      placeholder="选择日期时间">
   </el-date-picker>
   <el-button type="primary" @click="clickBtn">打印选择的时间</el-button>
</div>
<!-- 引入组件库 -->
<script type="text/javascript" src="${ctx}/static/common/js/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script type="text/javascript">
    new Vue({
        el: "#app",
        data: {
            value1: ""
        },
        methods: {
            clickBtn: function () {
                console.log(this.value1);
            }
        }

    });
</script>
</body>
</html>

Guess you like

Origin blog.csdn.net/samarket/article/details/91977843