| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <div>
- <h1>日期控件</h1>
- <h2>基本表单</h2>
- <div>
- <div class="form-group">
- <label for="datetime">日期</label>
- <Date
- v-model="dateValue0"
- @update:model-value="getNewDate"
- />
- </div>
- </div>
- {{ dateValue0 }} 更改次数 {{ changedCount0 }}
- <div>
- <div class="form-group">
- <label for="datetime">日期(日期时间强制转换)</label>
- <Date
- v-model="dateValue1"
- @update:model-value="changedCount1++"
- />
- </div>
- </div>
- {{ dateValue1 }} 更改次数 {{ changedCount1 }}
- <h2>内联表单</h2>
- <div class="form-inline">
- <div class="form-group">
- <label
- class="control-label"
- for="inputGroupSuccess3"
- >日期</label>
- <Date
- v-model="dateValueV2"
- />
- </div>
- </div>
- {{ dateValueV2 }}
- <h2>只读</h2>
-
- <div class="form-inline">
- <div class="form-group">
- <label
- class="control-label"
- for="inputGroupSuccess3"
- >日期</label>
- <Date
- v-model="dateValueV3"
- :readonly="true"
- />
- </div>
- </div>
- {{ dateValueV3 }}
- </div>
- </template>
- <script>
- import Date from '@/date/index.js';
- export default {
- name: 'DateExample',
- components: {
- Date,
- },
- data: function () {
- return {
- dateValue0: '2021-10-08',
- changedCount0: 0,
- dateValue1: '2021-10-09 17:54:00',
- changedCount1: 0,
- dateValueV2: '2021-10-09',
- changedCount2: 0,
- dateValueV3: '2022-10-09',
- changedCount3: 0,
- };
- },
- methods: {
- getNewDate(date) {
- console.log(date);
- this.changedCount0++;
- },
- },
- };
- </script>
- <style>
- </style>
|