<tfoot id='uP6Kp'></tfoot>
        <legend id='uP6Kp'><style id='uP6Kp'><dir id='uP6Kp'><q id='uP6Kp'></q></dir></style></legend>

      1. <i id='uP6Kp'><tr id='uP6Kp'><dt id='uP6Kp'><q id='uP6Kp'><span id='uP6Kp'><b id='uP6Kp'><form id='uP6Kp'><ins id='uP6Kp'></ins><ul id='uP6Kp'></ul><sub id='uP6Kp'></sub></form><legend id='uP6Kp'></legend><bdo id='uP6Kp'><pre id='uP6Kp'><center id='uP6Kp'></center></pre></bdo></b><th id='uP6Kp'></th></span></q></dt></tr></i><div id='uP6Kp'><tfoot id='uP6Kp'></tfoot><dl id='uP6Kp'><fieldset id='uP6Kp'></fieldset></dl></div>
          <bdo id='uP6Kp'></bdo><ul id='uP6Kp'></ul>

        <small id='uP6Kp'></small><noframes id='uP6Kp'>

      2. 如何在引导 timePicker 中设置最小值和最大值?

        How to set min and max value in bootstrap timePicker?(如何在引导 timePicker 中设置最小值和最大值?)

        <i id='2Voou'><tr id='2Voou'><dt id='2Voou'><q id='2Voou'><span id='2Voou'><b id='2Voou'><form id='2Voou'><ins id='2Voou'></ins><ul id='2Voou'></ul><sub id='2Voou'></sub></form><legend id='2Voou'></legend><bdo id='2Voou'><pre id='2Voou'><center id='2Voou'></center></pre></bdo></b><th id='2Voou'></th></span></q></dt></tr></i><div id='2Voou'><tfoot id='2Voou'></tfoot><dl id='2Voou'><fieldset id='2Voou'></fieldset></dl></div>

            <legend id='2Voou'><style id='2Voou'><dir id='2Voou'><q id='2Voou'></q></dir></style></legend>
              <tbody id='2Voou'></tbody>

                  <bdo id='2Voou'></bdo><ul id='2Voou'></ul>
                • <tfoot id='2Voou'></tfoot>

                  <small id='2Voou'></small><noframes id='2Voou'>

                  本文介绍了如何在引导 timePicker 中设置最小值和最大值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在我的应用程序中使用 vue-bootstrap,并在表单中有 2 个字段来填写时间.为此,我正在使用引导程序的 b-form-timepicker 组件,但它似乎没有设置最小值和最大值的功能,以限制可以选择的小时范围.在这种情况下,更好的解决方案是使用其他组件而不是 bootstrap nativo timepicker?

                  I'm using vue-bootstrap in my app, and have 2 fields in a form to fill with time. For it, I'm using b-form-timepicker component of bootstrap, but it appears to not have a function to set min and max values, to limit the range of hours can be selected. The better solution in this case is to use another component than bootstrap nativo timepicker?

                  推荐答案

                  解决这个问题的一种方法是使用 moment.js 中的 isBetween():state 验证状态以提供视觉提示,如果为 false 则阻止表单提交:

                  One way you could approach this is to use isBetween() from moment.js and the :state validation state to provide a visual cue and block form submission if false:

                  模板:

                  <b-form-timepicker v-model='time' :state='isValidTime' >
                  

                  脚本:

                  import moment from 'moment';
                  
                  ...
                  
                  format = 'hh:mm:ss';
                  time = null;
                  minTime = moment('10:30:00', this.format);
                  maxTime = moment('14:40:00', this.format);
                  
                  get isValidTime() {
                    return moment(this.time, this.format).isBetween(this.minTime, this.maxTime);
                  }
                  

                  您还可以使用 @input 事件,该事件将在时间值更改时触发.你可以把类似的验证代码放在那里.

                  You also have the @input event at your disposal which will fire when the time value changes. You could put similar validation code there.

                  使用 BootstrapVue 的示例验证状态行为:

                  Sample validation state behavior using BootstrapVue:

                  在此处了解更多验证状态.

                  这篇关于如何在引导 timePicker 中设置最小值和最大值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Pause youtube video, youtube api(暂停 youtube 视频,youtube api)
                  Youtube iframe api not triggering onYouTubeIframeAPIReady(Youtube iframe api 未触发 onYouTubeIframeAPIReady)
                  How can I stop a video with Javascript in Youtube?(如何在 Youtube 中停止使用 Javascript 的视频?)
                  How to call Greasemonkey#39;s GM_ functions from code that must run in the target page scope?(如何从必须在目标页面范围内运行的代码中调用 Greasemonkey 的 GM_ 函数?)
                  How do you mute an embedded Youtube player?(如何使嵌入式 Youtube 播放器静音?)
                  How to get number of video views with YouTube API?(如何使用 YouTube API 获取视频观看次数?)

                • <tfoot id='nKFTD'></tfoot>

                    • <bdo id='nKFTD'></bdo><ul id='nKFTD'></ul>
                      • <legend id='nKFTD'><style id='nKFTD'><dir id='nKFTD'><q id='nKFTD'></q></dir></style></legend>
                          <tbody id='nKFTD'></tbody>

                        <small id='nKFTD'></small><noframes id='nKFTD'>

                        <i id='nKFTD'><tr id='nKFTD'><dt id='nKFTD'><q id='nKFTD'><span id='nKFTD'><b id='nKFTD'><form id='nKFTD'><ins id='nKFTD'></ins><ul id='nKFTD'></ul><sub id='nKFTD'></sub></form><legend id='nKFTD'></legend><bdo id='nKFTD'><pre id='nKFTD'><center id='nKFTD'></center></pre></bdo></b><th id='nKFTD'></th></span></q></dt></tr></i><div id='nKFTD'><tfoot id='nKFTD'></tfoot><dl id='nKFTD'><fieldset id='nKFTD'></fieldset></dl></div>