【问题标题】:Remove month navigation buttons in uib-datepicker删除 uib-datepicker 中的月份导航按钮
【发布时间】:2017-07-19 07:15:44
【问题描述】:

如何禁用/删除 Angular uib-datepicker 上的月/年导航按钮 (https://angular-ui.github.io/bootstrap/#!#datepicker)

我们希望取消用户点击导航箭头之间的“月/年”文本但无法识别的功能

【问题讨论】:

  • 我相信,如果您更改模板,对于某些不包含 mont 的标头,将?template-url(默认:uib/template/datepicker/datepicker.html)

标签: javascript angularjs angular-ui-bootstrap jquery-ui-datepicker


【解决方案1】:

你可以用 CSS 隐藏它:

.uib-datepicker thead
{
    display:none;
}
 /* fix weeks padding if showing weeks */
.text-center.h6.ng-scope {
    padding: 8px;
}

【讨论】:

    【解决方案2】:

    您必须访问模板 html 本身并删除/禁用与该按钮关联的 input

    The template on github can be found here

    您必须修改第 5 行

     <th colspan="{{::5 + showWeeks}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th>
    

    这仅适用于日模式,如果需要,您可以对月和年模式执行相同操作

    【讨论】:

      猜你喜欢
      • 2019-09-18
      • 2019-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-08
      相关资源
      最近更新 更多