我可能做了一些愚蠢的错误。我正在使用 Polymer 1.0
并尝试制作一个非常基本的模块。但是当我指定布局属性
时,它们将不起作用。但是,如果我输入 class="layout flex [etc..]"
等,它将起作用。见下文:
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
<script src="bower_components/time-elements/time-elements.js"></script>
<link rel="import" href="/bower_components/polymer/polymer.html">
<dom-module id="x-chat-list">
<template>
<section class="user-list" layout horizontal>
<div class="avatar {{color}}" style="background-image: url({{avatar}})">
<div class="status {{status}}"></div>
</div>
<div flex>
<div class="username">{{username}}</div>
<div class="text">{{text}}</div>
</div>
<time class="timestamp" is="relative-time" datetime="{{timestamp}}"></time>
</section>
</template>
<script>
Polymer({
is: 'x-chat-list',
properties: {
avatar: '',
color: '',
username: '',
text: '',
status: '',
timestamp: new Date().toISOString()
}
});
</script>
</dom-module>
就好像它无法识别 polymer 或其他东西。
谢谢!
最佳答案
布局属性已在 1.0 中删除并替换为布局类 ( migration guide )。因此,当您使用这些类时,您就在做正确的事情。
关于javascript - 布局属性不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32039591/