【问题标题】:How can I adjust progressbar layout inside select in angular material如何在角度材料中选择内部调整进度条布局
【发布时间】:2016-03-13 17:36:28
【问题描述】:

我有以下角度材质代码

<div ng-app="MyApp" ng-controller="AppCtrl as ctrl">
  <md-input-container>
    <label>SOME_LABEL</label>
    <md-select ng-model="some.model">
      <md-option value="SOME_OPTION_HERE" ng-disabled="$index === 1">
        SOME_OPTION_HERE
        <md-progress-linear md-mode="determinate" value="25"></md-progress-linear>
      </md-option>
      <md-option value="SOME_OTHER_OPTION_HERE" ng-disabled="$index === 1">
        SOME_OTHER_OPTION_HERE
        <md-progress-linear md-mode="determinate" value="35"></md-progress-linear>
      </md-option>
    </md-select>
  </md-input-container>
</div>

It shows the progressbars at the bottom of the option, but they are not 100% wide when select dropdown is visible.此外,选择选项时,将垂直剪切进度条。如何在选择选项后显示完整的进度条高度并显示 100% 宽度的进度条?

Codepen 链接:http://codepen.io/anon/pen/XdjaeK

【问题讨论】:

    标签: css angular-material


    【解决方案1】:

    md-option ._md-textwidth 设置为100%,而不是auto

    然后它采用它所在元素的全宽,而不是选项名称的宽度。

    md-option ._md-text {
      width: 100%;
    }
    

    编辑

    另一个问题是因为._md-select-value *:first-child 的高度。我也更新了我的 CodePen 来解决这个问题。

    ._md-select-value {
      height: 50px; /*Set height for select */
    }
    
    ._md-select-value *:first-child {
      height: 30px; /*Set height for selected value (including bar)
    }
    

    在此处查看我的更新 CodePen:http://codepen.io/anon/pen/wGzqxb

    【讨论】:

    • 非常感谢罗伊!正是我需要的。
    • @RamandeepSingh 很高兴我能帮上忙。请务必使用您喜欢的浏览器的 网络检查器 来调查您的应用程序中发生了什么。
    • 我是 css 新手,只是没有让我去查找网络检查器。 这里是尴尬的笑脸。现在我查了一下,确实有道理。再次感谢。
    猜你喜欢
    • 1970-01-01
    • 2018-04-17
    • 1970-01-01
    • 1970-01-01
    • 2016-10-18
    • 2017-10-28
    • 2020-02-06
    • 2019-07-16
    • 2020-09-20
    相关资源
    最近更新 更多