微信小程序 eslint 插件 eslint-plugin-wxml v0.4.1 发布

栏目: 软件资讯 · 发布时间: 5年前

内容简介:eslint-plugin-wxml 微信小程序eslint插件 eslint-plugin-wxml 于2021年11月5日发布了新版v0.4.1 1. 新增了规则 wxml/no-wx-if-string,用于校验警告在使用wx:if/wx:elif时必须使用有效的布尔值插值,否则会产生预...

微信小程序 eslint 插件 eslint-plugin-wxml v0.4.1 发布

eslint-plugin-wxml

微信小程序eslint插件 eslint-plugin-wxml 于2021年11月5日发布了新版v0.4.1

1. 新增了规则 wxml/no-wx-if-string,用于校验警告在使用wx:if/wx:elif时必须使用有效的布尔值插值,否则会产生预期之外的结果

<view wx:if="{{user}}"> {{user.name}}</view>

If you use wx:if/wx:elif as control flow, make sure wx:if/wx:elif's value is a boolean, not a string (or dynamic string), otherwise the value will always be true, your code logic will be broken.


wx:if="{{show}} "  => wx:if="true " => true
wx:if="{{show}} "  => wx:if="false " => true
wx:if="{{show}}-s"  => wx:if="true-s" => true
wx:if="{{show}}-s"  => wx:if="false-s" => true

eslint插件使用示例:

微信小程序 eslint 插件 eslint-plugin-wxml v0.4.1 发布

官方文档地址: https://eslint-plugin-wxml.js.org

相关代码变更详见  https://github.com/wxmlfile/eslint-plugin-wxml/compare/v0.4.0...v0.4.1


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。

Web Development Recipes

Web Development Recipes

Brian P. Hogan、Chris Warren、Mike Weber、Chris Johnson、Aaron Godin / Pragmatic Bookshelf / 2012-1-22 / USD 35.00

You'll see a full spectrum of cutting-edge web development techniques, from UI and eye candy recipes to solutions for data analysis, testing, and web hosting. Make buttons and content stand out with s......一起来看看 《Web Development Recipes》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换