不知何故我放在{{color}}
和{{avatar}}
中的變量不會被實際內容解釋/交換。見下面的例子:{{variable}}不解釋
<paper-toolbar id="navheader" class="tall">
<div class="middle avatar {{color}}" style="background-image: url({{avatar}})"></div>
<div class="bottom uuid">{{uuid}}</div>
</paper-toolbar>
如果我不是把顏色可變,其中uuid
是,它會打印正確color
,這意味着它不是變量沒有被設置或不published
。這似乎是干擾的,我做錯了什麼?值得一提的是,這是在「主要」文件中完成的。
全部下面的代碼:
<paper-drawer-panel id="drawerPanel" responsive-width="1280px">
<div class="nav" drawer>
<paper-toolbar id="navheader" class="tall">
<div class="middle avatar {{color}}" style="background-image: url({{avatar}})"></div>
<div class="bottom uuid">{{uuid}}</div>
</paper-toolbar>
<section class="layout vertical" id="onlineList">
<paper-item label="Online Now" class="subdue layout horizontal center"></paper-item>
<template is="dom-repeat" items="{{cats}}" as="cat">
<paper-item label="{{cat}}"></paper-item>
</template>
</section>
</div>
<paper-header-panel main mode="waterfall">
<paper-toolbar>
<div class="flex">Kitteh Anonymous</div>
<iron-icon icon="account-circle"></iron-icon><span>{{occupancy}}</span>
</paper-toolbar>
<!-- Main Content -->
<div class="layout vertical fit" id="chat">
<div class="chat-list flex">
<!--<x-chat-list avatar="url" username="name" text="hello" status="online" timestamp="1420145273945"></x-chat-list>-->
<template is="dom-repeat" items="{{messageList}}" as="message">
<x-chat-list color="{{message.color}}" avatar="{{message.avatar}}" username="{{message.uuid}}" text="{{message.text}}" status="{{message.status}}" timestamp="{{message.timestamp}}"></x-chat-list>
</template>
</div>
<div class="shim"></div>
<div class="send-message layout horizontal">
<paper-input class="flex" label="Type message..." id="input" value="{{input}}" on-keyup="checkKey"></paper-input>
<paper-fab icon="send" id="sendButton" on-tap="sendMyMessage"></paper-fab>
</div>
</div>
</paper-header-panel>
</paper-drawer-panel>
嗯好的,謝謝。那麼,我該如何「添加」類等呢? :o – Whyser
根據元素中的狀態計算出的屬性將成爲我的第一個想法。 – newfivefour