Skip to main content

babel-plugin-direactive

github.com

一个Babel插件,为React开发者提供类似Vue的模板指令(如r-if、r-for等),使React代码更简洁易读,特别适合熟悉Vue的前端开发者。

Developer Tools & APIs#react#babel-plugin#vue-directives
Visit website
babel-plugin-direactive preview

一个babel插件,可以让React模板表达对熟练Vue的前端开发者更友好### 项目地址:https://github.com/wangzongxu/babel-plugin-direactive### 举例- 使用指令之前jsxfunction Component() { return ( <section> { isLoadong ? <div>Loading...</div> : error ? <div>{error}</div> : shopList.length > 0 ? ( <ul> { shopList.map(shop => ( <li key={shop.id}> <h5>{shop.name}</h5> <ul style={{ display: isShowProducts ? 'block' : 'none' }}> { shop.productList.map(product => ( <li key={product.id}> <h6>{product.name}</h6> </li> )) } </ul> </li> )) } </ul> ) : <div>Empty</div> } </section> )}- 使用指令之后jsxfunction Component() { return ( <section> <div r-if={isLoadong}>Loading...</div> <div r-else-if={error}>{error}</div> <ul r-else-if={shopList.length > 0}> <li r-for="shop in shopList" r-key="shop.id"> <h6>{shop.name}</h6> <ul r-show={isShowProducts}> <li r-for="product in shop.productList" r-key="product.id"> <h6>{product.name}</h6> </li> </ul> </li> </ul> <div r-else>Empty</div> </section> )}### 支持的指令- r-if- r-else-if- r-else- r-for/r-key- r-show- r-html- r-text- r-pre- r-model

More in Developer Tools & APIs

SolveHub

API for CAPTCHA and anti-bot tasks in authorized testing

Dev Tools ·

liarjs.dev

Scanner that cross-checks browser JavaScript fingerprint against network layer

Dev Tools ·

AntiBrow

Antidetect browser for managing multiple browser identities with real-device

Dev Tools ·

HostlessWP

Open source CLI to move WordPress to Cloudflare Workers

Dev Tools ·

deed.page

Permanent web hosting with an API for AI agents

Dev Tools ·

Rowflare

Open-source Airtable alternative running on your Cloudflare account

Dev Tools ·