@wecity/weda-react-mobile
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

react-kbone

使用 react 多端开发(小程序和Web),基于 kbone 的 element 和 render。

特性

  • 一键接入,立即使用
  • 支持完整 JSX 语法,任意位置任意方式书写 JSX
  • webpack、hook、es2018+、babel7+、jsx、hot reload、cli,你想要的都有

一套语法多端运行

import React, { useState } from 'react'
import './index.css'

function Counter() {
  const [count, setCount] = useState(0)
  return (
    <div>
      <button onClick={() => setCount(count - 1)}>-</button>
      <span>{count}</span>
      <button onClick={() => setCount(count + 1)}>+</button>
      <div onClick={clickHandle}>跳转</div>
    </div>
  )
}

function clickHandle() {
  if ("undefined" != typeof wx && wx.getSystemInfoSync) {
    wx.navigateTo({
      url: '../log/index?id=1'
    })
  } else {
    location.href = 'log.html'
  }
}

export default Counter

快速开始

npx kbone-cli init my-app
cd my-app
npm run mp       //开发小程序
npm run web      //开发 web
npm run build    //发布 web

目录说明

├─ build
│  ├─ mp     //微信开发者工具指向的目录,用于生产环境
│  ├─ web    //web 编译出的文件,用于生产环境
├─ config
├─ public
├─ scripts
├─ src
│  ├─ assets
│  ├─ components    //存放所有组件
│  ├─ log.js        //入口文件,会 build 成  log.html
│  └─ index.js      //入口文件,会 build 成  index.html

谁在使用 kbone?

告诉我们

License

MIT

Versions

Current Tags

Version History

Package Sidebar

Install

npm i @wecity/weda-react-mobile

Weekly Downloads

0

Version

1.0.7

License

MIT

Unpacked Size

680 kB

Total Files

253

Last publish

Collaborators

  • loopzhou
  • zystylish
  • brian_zhang
  • legendlu
  • fenfeizeng
  • colinczhu
  • easonruan
  • yikazhu
  • daniel-dx
  • domy
  • delenzhang
  • vickiliang
  • derrickliu
  • xiaoyaojones
  • smileswlin
  • jillysong
  • allennzhang
  • sharryliao
  • pechelhuang
  • phspan