当前位置:主页 > 查看内容

Riot 4.7.1 发布 简单优雅的基于组件的UI库

发布时间:2021-10-22 00:00| 位朋友查看

简介:Riot 4.7.1 发布了,此版本修复了一个循环项属性编译问题: 带有“each”项目属性的标签中的内容无法正确读取,错误是“ TypeError:scope.item.scope 未定义”。问题是编译器确实会生成返回 scope.classNames({active: scope.item.scope.isActive}); 而不是……

Riot 4.7.1 发布了,此版本修复了一个循环项属性编译问题:

带有“each”项目属性的标签中的内容无法正确读取,错误是“ TypeError:scope.item.scope 未定义”。问题是编译器确实会生成返回 scope.classNames({active: scope.item.scope.isActive}); 而不是返回 scope.classNames({active: scope.item.scope.isActive});

<my-tag>
	<select multiple>
	  <option class="{classNames({active: item.isActive})}" each="{item in items}">
	    {item.name}
	  </option>
	</select>

  <style>
    .active { font-weight: bolder; }
  </style>

  <script>
    export default {
      items: [
        {name: "foo", isActive: true},
        {name: "bar", isActive: false},
      ],
      classNames: (classes) => {
        return Object.entries(classes).reduce((acc, item) => {
          const [key, value] = item
          if (value) return [...acc, key]
          return acc
          }, []).join(' ')
      }
    }
  </script>

</my-tag>

详情查看:

  • https://github.com/riot/riot/releases/tag/v4.7.1
  • https://github.com/riot/riot/issues/2788

Riot 是一个简单而优雅的基于组件的 UI 库,为所有现代浏览器带来了自定义组件。其支持浏览器包括:

它的体积也很小,只有 6k:

本文原标题:Riot 4.7.1 发布,简单优雅的基于组件的 UI 库

本文原地址:https://www.oschina.net/news/111920/riot-4-7-1-released


本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文


随机推荐