Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- 用於 https://mrjustin-note.blogspot.com -->
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Vue bootstrap 4 date-time picker</title>
- <!-- fontawesome -->
- <link href="https://unpkg.com/@fortawesome/fontawesome-free-webfonts@1.0.9/css/fontawesome.css" rel="stylesheet" />
- <link href="https://unpkg.com/@fortawesome/fontawesome-free-webfonts@1.0.9/css/fa-solid.css" rel="stylesheet" />
- <link href="https://unpkg.com/@fortawesome/fontawesome-free-webfonts@1.0.9/css/fa-regular.css" rel="stylesheet" />
- <!-- bootstrap -->
- <link href="https://unpkg.com/bootstrap@4.1.1/dist/css/bootstrap.min.css" rel="stylesheet" />
- <!-- pc-bootstrap4-datetimepicker -->
- <link href="https://unpkg.com/pc-bootstrap4-datetimepicker@4.17.50/build/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
- </head>
- <body>
- <div id="app" class="container">
- <div class="row">
- <div class="col-md-12">
- <h1 class="h3">
- Vue bootstrap 4 date-time picker
- </h1>
- <date-picker name="date" v-model="date" :config="options"></date-picker>
- <hr>
- <p>
- v-model: {{date}}
- </p>
- </div>
- </div>
- <div class="row text-center">
- <a target="_blank" href="https://github.com/ankurk91/vue-bootstrap-datetimepicker">Get this package</a>
- </div>
- </div>
- <!-- jQuery -->
- <script src="https://unpkg.com/jquery@3.2.1/dist/jquery.min.js"></script>
- <!-- Moment.js -->
- <script src="https://unpkg.com/moment@2.18.1/min/moment.min.js"></script>
- <script src="https://unpkg.com/moment@2.18.1/min/moment-with-locales.min.js"></script>
- <!-- datetimepicker -->
- <script src="https://unpkg.com/pc-bootstrap4-datetimepicker@4.17.50/build/js/bootstrap-datetimepicker.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/vue-bootstrap-datetimepicker@5"></script>
- <!-- Vue.js -->
- <script src="https://unpkg.com/vue@2.5.22/dist/vue.min.js"></script>
- <script>
- // Initialize as global component
- Vue.component('date-picker', VueBootstrapDatetimePicker);
- // Using font-awesome 5 icons
- $.extend(true, $.fn.datetimepicker.defaults, {
- icons: {
- time: 'far fa-clock',
- date: 'far fa-calendar',
- up: 'fas fa-arrow-up',
- down: 'fas fa-arrow-down',
- previous: 'fas fa-chevron-left',
- next: 'fas fa-chevron-right',
- today: 'fas fa-calendar-check',
- clear: 'far fa-trash-alt',
- close: 'far fa-times-circle'
- }
- });
- new Vue({
- el: '#app',
- data: {
- date: null,
- options: {
- // https://momentjs.com/docs/#/displaying/
- format: 'YYYY/MM/DD h:mm:ss',
- useCurrent: false,
- showClear: true,
- showClose: true,
- locale: 'zh-tw'
- }
- },
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement