active绑定

为元素添加:active效果,当元素被点击时添加几个类名, 鼠标弹起后则立即移除

  1. <body ms-controller="test">
  2. <script>
  3. avalon.define({
  4. $id: 'test',
  5. aaa: "aaa bbb ccc",
  6. bbb: 'ddd',
  7. ccc: ['xxx', 'yyy', 'zzz'],
  8. ddd: 'eee',
  9. toggle: true,
  10. toggle2: false
  11. })
  12. </script>
  13. <span :active="@aaa">直接引用字符串</span>
  14. <span :active="@ccc">直接引用数组</span>
  15. <span :active="[@aaa, @bbb]">使用数组字面量</span>
  16. <span :active="['aaa', 'bbb',(@toggle? 'ccc':'ddd')]">选择性添加类名</span>
  17. <span :active="[@toggle && 'aaa']">选择性添加类名</span>
  18. <span :active="[ @ddd + 4]">动态生成类名</span>
  19. </body>