gpt4 book ai didi

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?

转载 作者:可可西里 更新时间:2023-11-01 13:07:27 26 4
gpt4 key购买 nike

我已经在 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”、“.horizo​​ntal”、“.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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com