我想把桌子剥成绿色或红色(boostrap)。 以下是上下文:我从ajax调用中收到一个列表,这里是表格行:
public function onBootstrap(EventInterface $event){
$container = $event->getApplication()->getServiceManager();
$dbAdapter = $container->get(AdapterInterface::class);
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new TableObjectClass());
$tableGateway = new TableGateway("Table name", $dbAdapter, null, $resultSetPrototype);
$mapper = new TableObjectClassMapper($tableGateway);
//and use $mapper to get data from the table and store it as TableObjectClass
$data = $mapper->fetch()->current();
}
我的项目清单是:
<tr v-for="item in items" class=getStyle(item)>
<td>{{item.line}}</td>
</tr>
当他通过ajax调用接收时,Type的值是Enum(值== 0/1)。 所以如果item.type == 0,我想添加类&#34; table-success&#34;否则想要添加类&#34; table-error&#34;。
public class Wall
{
public String Line{ get; set; }
public BookRetrive Type { get; set; }
}
但是我无法得到它,你能帮助我吗? 谢谢