作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我已经在 polymer 0.5 中构建了我的应用程序。
现在我已经将它更新到 polymer 1.0。
对于响应式布局,我使用了一个布局属性,它使用 Polymer 0.5 中布局属性的自定义逻辑。
请看下面的代码:
<template is="auto-binding">
<core-media-query query="max-width: 767px" queryMatches="{{smallScreen}}"></core-media-query>
<section layout vertical?="{{smallScreen}}" horizontal?="{{!smallScreen}}">
<section flex four?="{{!smallScreen}}" auto?="{{smallScreen}}">
<paper-input-decorator label="First name" floatingLabel>
<input type="text" is="paper-input" id="fname" name="fname">
</paper-input-decorator>
</section>
<section flex four?="{{!smallScreen}}" auto?="{{smallScreen}}">
<paper-input-decorator label="Last name" floatingLabel>
<input type="text" is="paper-input" id="lname" name="lname">
</paper-input-decorator>
</section>
</section>
</template>
现在在 polymer 1.0 中引入了一个元素“iron-layout-flex”,所有迹象表明现在我们必须使用类“.layout”、“.horizontal”、“.vertical”来代替属性?很困惑,我应该如何根据我的布局属性逻辑进行调整。
所以,我的问题是,有什么方法可以将“布局”用作属性而不是用作 CSS 类或在类属性中使用属性序列化?
最佳答案
好吧,理论上您可以将属性转换为新的布局 css 属性。像这样的东西(未经测试,所以不能保证这真的有效)
<style is="custom-style">
html /deep/ [layout][vertical] {
@apply(--layout-vertical);
}
html /deep/ [layout][horizontal] {
@apply(--layout-horizontal);
}
html /deep/ [flex][four] {
@apply(--layout-flex-4);
}
html /deep/ [flex][auto] {
@apply(--layout-flex-auto);
}
</style>
关于javascript - polymer 1.0 : Is there any way to use 'layout' as an attribute instead of as a CSS class or using Attribute serialization in the class attribute?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30664216/
我是一名优秀的程序员,十分优秀!