Advertisement
imjyb1008

Vue bootstrap 4 date-time picker zh-tw

Apr 26th, 2022
1,844
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.42 KB | None | 0 0
  1. <!-- 用於 https://mrjustin-note.blogspot.com -->
  2. <!DOCTYPE html>
  3. <html lang="en">
  4.  
  5. <head>
  6.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9.     <title>Vue bootstrap 4 date-time picker</title>
  10.  
  11.     <!-- fontawesome -->
  12.     <link href="https://unpkg.com/@fortawesome/fontawesome-free-webfonts@1.0.9/css/fontawesome.css" rel="stylesheet" />
  13.     <link href="https://unpkg.com/@fortawesome/fontawesome-free-webfonts@1.0.9/css/fa-solid.css" rel="stylesheet" />
  14.     <link href="https://unpkg.com/@fortawesome/fontawesome-free-webfonts@1.0.9/css/fa-regular.css" rel="stylesheet" />
  15.  
  16.     <!-- bootstrap -->
  17.     <link href="https://unpkg.com/bootstrap@4.1.1/dist/css/bootstrap.min.css" rel="stylesheet" />
  18.  
  19.     <!-- pc-bootstrap4-datetimepicker -->
  20.     <link href="https://unpkg.com/pc-bootstrap4-datetimepicker@4.17.50/build/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
  21.  
  22. </head>
  23.  
  24. <body>
  25.  
  26.     <div id="app" class="container">
  27.  
  28.         <div class="row">
  29.             <div class="col-md-12">
  30.                 <h1 class="h3">
  31.                     Vue bootstrap 4 date-time picker
  32.                 </h1>
  33.                 <date-picker name="date" v-model="date" :config="options"></date-picker>
  34.                 <hr>
  35.                 <p>
  36.                     v-model: {{date}}
  37.                 </p>
  38.             </div>
  39.         </div>
  40.  
  41.         <div class="row text-center">
  42.             <a target="_blank" href="https://github.com/ankurk91/vue-bootstrap-datetimepicker">Get this package</a>
  43.         </div>
  44.  
  45.     </div>
  46.  
  47.     <!-- jQuery -->
  48.     <script src="https://unpkg.com/jquery@3.2.1/dist/jquery.min.js"></script>
  49.  
  50.     <!-- Moment.js -->
  51.     <script src="https://unpkg.com/moment@2.18.1/min/moment.min.js"></script>
  52.     <script src="https://unpkg.com/moment@2.18.1/min/moment-with-locales.min.js"></script>
  53.  
  54.     <!-- datetimepicker -->
  55.     <script src="https://unpkg.com/pc-bootstrap4-datetimepicker@4.17.50/build/js/bootstrap-datetimepicker.min.js"></script>
  56.     <script src="https://cdn.jsdelivr.net/npm/vue-bootstrap-datetimepicker@5"></script>
  57.  
  58.     <!-- Vue.js -->
  59.     <script src="https://unpkg.com/vue@2.5.22/dist/vue.min.js"></script>
  60.  
  61.     <script>
  62.         // Initialize as global component
  63.         Vue.component('date-picker', VueBootstrapDatetimePicker);
  64.  
  65.         // Using font-awesome 5 icons
  66.         $.extend(true, $.fn.datetimepicker.defaults, {
  67.             icons: {
  68.                 time: 'far fa-clock',
  69.                 date: 'far fa-calendar',
  70.                 up: 'fas fa-arrow-up',
  71.                 down: 'fas fa-arrow-down',
  72.                 previous: 'fas fa-chevron-left',
  73.                 next: 'fas fa-chevron-right',
  74.                 today: 'fas fa-calendar-check',
  75.                 clear: 'far fa-trash-alt',
  76.                 close: 'far fa-times-circle'
  77.             }
  78.         });
  79.  
  80.         new Vue({
  81.             el: '#app',
  82.             data: {
  83.                 date: null,
  84.                 options: {
  85.                     // https://momentjs.com/docs/#/displaying/
  86.                     format: 'YYYY/MM/DD h:mm:ss',
  87.                     useCurrent: false,
  88.                     showClear: true,
  89.                     showClose: true,
  90.                     locale: 'zh-tw'
  91.                 }
  92.             },
  93.         });
  94.     </script>
  95.  
  96. </body>
  97.  
  98. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement