Javascript AngularJS 材料布局 - flex 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28442178/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 01:47:25  来源:igfitidea点击:

AngularJS material layout - issues with flex

javascripthtmlangularjsflexboxangular-material

提问by vlio20

I have a problem setting the flex properties of my layout. Here is a plunker: http://embed.plnkr.co/0SrUp25FvT2PAsJDEwF3/preview

我在设置布局的 flex 属性时遇到问题。这是一个plunker:http://embed.plnkr.co/0SrUp25FvT2PAsJDEwF3/preview

  <md-content flex layout="row" layout-align="center">
    <div layout="column">
      <div flex layout="column" layout-fill>
        <div flex="33">
          <md-input-container>
            <label>Enter Room's Name</label>
            <input ng-model="test" placeholder="Enter Room's Name">
          </md-input-container>
        </div>
        <div flex="66">
          <md-button class="md-raised md-accent">
            Create Chat Room
          </md-button>
        </div>
      </div>
    </div>
  </md-content>

Here is the link to documentation: https://material.angularjs.org/#/layout/grid

这是文档的链接:https: //material.angularjs.org/#/layout/grid

The issue that the flex property of the input (text) and input (button) are not obeying the flex attribute.

输入(文本)和输入(按钮)的 flex 属性不服从 flex 属性的问题。

What I am trying to achieve is something like that: enter image description here

我想要实现的是这样的: 在此处输入图片说明

回答by dsteve

here is the result after I tried it,

这是我试过之后的结果

hopefully it helps:

希望它有帮助:

<md-content layout="row" layout-align="center">
  <div layout="column">
    <div flex layout="column" layout-fill> <!-- this is what I change -->
      <div flex="33">
        <md-input-container>
          <label>Enter Room's Name</label>
          <input ng-model="test" placeholder="Enter Room's Name">
        </md-input-container>
      </div>
      <div flex="66">
        <md-button class="md-raised md-accent">
          Create Chat Room
        </md-button>
      </div>
    </div>
  </div>

</md-content>