微信小程序奇奇怪怪的语法

这。。。

<view class="body">
  <view class="nav bc_white">
    <view class='hidden'>no show</view>
    <view class='{{true?"show":"hidden"}}'>true show</view>
    <view class='{{false?"show":"hidden"}}'>false show</view>
    <view class='show'>show</view>
  </view>
</view>

css

.hidden{display:none;text-align:center;line-height:200px;}

结果


true show show

<template is="objectCombine" data="{{foo, bar}}"></template>
Page({
  data: {
    foo: 'my-foo',
    bar: 'my-bar'
  }
})
最终组合成的对象是 {foo: 'my-foo', bar:'my-bar'}。   emmm...
原文地址:https://www.cnblogs.com/tangpg/p/9641110.html