hover绑定

用于类实现:hover伪类的效果, 当用户鼠标移动元素上方时添加几个类名, 鼠标移走时将刚才的 类名移除

用法类似于类名绑定

  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 :hover="@aaa">直接引用字符串</span>
  14. <span :hover="@ccc">直接引用数组</span>
  15. <span :hover="[@aaa, @bbb,'kkk']">使用对象字面量</span>
  16. <span :hover="['aaa', 'bbb',(@toggle? 'ccc':'ddd')]">选择性添加类名</span>
  17. <span :hover="[@toggle && 'aaa']">选择性添加类名</span>
  18. <span :hover="[ @ddd + 4]">动态生成类名</span>
  19. </body>