Top Related Projects
Quick Overview
Kbone is a framework for building cross-platform applications that can run on both the web and WeChat mini-programs. It provides a unified API and development experience, allowing developers to create applications that can seamlessly run on multiple platforms.
Pros
- Cross-Platform Compatibility: Kbone enables developers to create applications that can run on both the web and WeChat mini-programs, reducing the need for separate codebases.
- Unified Development Experience: Kbone provides a consistent API and development workflow, making it easier for developers to build and maintain their applications.
- Performance Optimization: Kbone is designed to optimize performance by leveraging platform-specific features and optimizations.
- Extensive Documentation: The Kbone project has comprehensive documentation, including guides, tutorials, and API references, making it easier for developers to get started and learn the framework.
Cons
- Limited to WeChat Mini-Programs: Kbone is primarily focused on supporting WeChat mini-programs, which may limit its usefulness for developers who need to target other platforms.
- Steep Learning Curve: Developers who are new to Kbone may face a steeper learning curve, as they need to understand the framework's unique concepts and development workflow.
- Potential Vendor Lock-in: By using Kbone, developers may become more dependent on the WeChat ecosystem, which could lead to vendor lock-in concerns.
- Ongoing Maintenance: As a relatively new framework, Kbone may require more ongoing maintenance and updates to keep up with changes in the WeChat mini-program ecosystem.
Code Examples
Example 1: Creating a Simple Page
import { render, h } from 'kbone';
const App = () => (
<div>
<h1>Hello, Kbone!</h1>
<p>This is a simple Kbone application.</p>
</div>
);
render(<App />, document.getElementById('app'));
This code demonstrates how to create a simple page using Kbone's render
and h
functions.
Example 2: Handling User Interactions
import { render, h, useState } from 'kbone';
const Counter = () => {
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>Click me</button>
</div>
);
};
render(<Counter />, document.getElementById('app'));
This example shows how to handle user interactions and manage state using Kbone's useState
hook.
Example 3: Accessing Platform-Specific APIs
import { render, h, useEffect } from 'kbone';
import { getSystemInfo } from 'kbone/api';
const SystemInfo = () => {
const [systemInfo, setSystemInfo] = useState(null);
useEffect(() => {
const fetchSystemInfo = async () => {
const info = await getSystemInfo();
setSystemInfo(info);
};
fetchSystemInfo();
}, []);
return (
<div>
{systemInfo ? (
<p>
Device Model: {systemInfo.model}
<br />
System Version: {systemInfo.system}
</p>
) : (
<p>Loading system information...</p>
)}
</div>
);
};
render(<SystemInfo />, document.getElementById('app'));
This code demonstrates how to access platform-specific APIs, such as the getSystemInfo
function, using Kbone.
Getting Started
To get started with Kbone, follow these steps:
- Install the Kbone CLI:
npm install -g kbone-cli
- Create a new Kbone project:
kbone-cli create my-app
- Navigate to the project directory and install dependencies:
cd my-app
npm install
- Start the development server:
npm run dev
This will start the development server and open your application in the browser. You can also run the application in a WeChat mini-program environment by following the instructions
Competitor Comparisons
一个致力于微信小程序和 Web 端同构的解决方案
Pros of kbone
- Comprehensive cross-platform development framework
- Supports multiple mini-program platforms
- Extensive documentation and community support
Cons of kbone
- Steeper learning curve for beginners
- May have more overhead for simpler projects
- Requires additional configuration for complex scenarios
Code Comparison
kbone example:
import { h, render } from 'vue'
import App from './App.vue'
render(h(App), document.getElementById('app'))
kbone example:
import { h, render } from 'vue'
import App from './App.vue'
render(h(App), document.getElementById('app'))
As both repositories are the same (Tencent/kbone), there are no actual differences in the code or features to compare. The code examples provided are identical, demonstrating a basic Vue.js application setup using kbone.
kbone is a powerful framework for developing cross-platform applications, particularly for WeChat mini-programs and web applications. It offers a unified development experience, allowing developers to write code once and deploy it across multiple platforms. While it may have a steeper learning curve, its extensive features and community support make it a valuable tool for complex, multi-platform projects.
A cross-platform framework using Vue.js
Pros of uni-app
- Supports a wider range of platforms, including iOS, Android, Web, and various mini-program ecosystems
- Offers a more comprehensive development framework with built-in UI components and APIs
- Provides a unified development experience across multiple platforms
Cons of uni-app
- Steeper learning curve due to its proprietary syntax and framework-specific concepts
- May have limitations when accessing platform-specific features or implementing complex custom UI
Code Comparison
uni-app:
<template>
<view>
<text>{{ message }}</text>
</view>
</template>
<script>
export default {
data() {
return {
message: 'Hello, uni-app!'
}
}
}
</script>
kbone:
import { h, createApp } from 'vue'
const app = createApp({
render() {
return h('div', [h('span', 'Hello, kbone!')])
}
})
app.mount('#app')
Key Differences
- uni-app uses a Vue-like single-file component structure, while kbone relies on standard web development practices
- uni-app provides a more abstracted approach to cross-platform development, whereas kbone focuses on web-to-miniprogram conversion
- kbone offers more flexibility for existing web projects, while uni-app is better suited for new cross-platform applications
开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
Pros of Taro
- Supports multiple platforms (Web, WeChat Mini Program, Alipay Mini Program, etc.)
- Large and active community with extensive documentation
- Provides a unified development experience across platforms
Cons of Taro
- Steeper learning curve due to its comprehensive nature
- May have performance overhead in some scenarios
- Limited access to platform-specific APIs without custom components
Code Comparison
Taro (React-like syntax):
import { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
export default class Index extends Component {
render() {
return (
<View>
<Text>Hello, World!</Text>
</View>
)
}
}
Kbone (Vue syntax):
<template>
<div>
<p>Hello, World!</p>
</div>
</template>
<script>
export default {
name: 'HelloWorld'
}
</script>
Key Differences
- Taro uses a React-like syntax, while Kbone supports Vue
- Taro focuses on cross-platform development, Kbone emphasizes Web-to-WeChat Mini Program conversion
- Taro has a more opinionated structure, Kbone offers more flexibility in project setup
Use Cases
- Choose Taro for multi-platform projects with a preference for React-like syntax
- Opt for Kbone when converting existing Vue web apps to WeChat Mini Programs
使用真正的 React 构建跨平台小程序
Pros of Remax
- Simpler API and more intuitive development experience for React developers
- Better TypeScript support and type inference
- More flexible and customizable build process
Cons of Remax
- Smaller community and ecosystem compared to Kbone
- Limited to React framework, while Kbone supports multiple frameworks
- Less comprehensive documentation and examples
Code Comparison
Remax example:
import React from 'react';
import { View, Text } from 'remax/wechat';
export default () => (
<View>
<Text>Hello, Remax!</Text>
</View>
);
Kbone example:
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
ReactDOM.render(<App />, document.getElementById('app'))
Both Remax and Kbone aim to simplify cross-platform development for mini-programs, but they take different approaches. Remax focuses on providing a React-like development experience specifically for mini-programs, while Kbone offers a more general solution for adapting web applications to mini-program environments.
Remax provides a more straightforward development experience for React developers, with better TypeScript support and a more flexible build process. However, it has a smaller community and ecosystem compared to Kbone, and is limited to the React framework.
Kbone, on the other hand, supports multiple frameworks and has a larger community, but may have a steeper learning curve and less intuitive API for React developers.
🦎 一套代码运行多端,一端所见即多端所见
Pros of Chameleon
- Supports a wider range of platforms, including web, WeChat Mini Program, Alipay Mini Program, Baidu Smart Program, and native apps
- Provides a more comprehensive framework for cross-platform development, including routing and state management
- Offers a unified API layer for consistent development across platforms
Cons of Chameleon
- Steeper learning curve due to its custom DSL and framework-specific concepts
- Less focus on web-to-WeChat Mini Program conversion, which is Kbone's primary strength
- Smaller community and ecosystem compared to Kbone
Code Comparison
Chameleon component example:
<template>
<view>
<text>{{message}}</text>
</view>
</template>
<script>
class Index {
data = {
message: 'Hello Chameleon'
}
}
export default new Index();
</script>
Kbone component example:
import { h, createApp } from 'vue'
createApp({
render() {
return h('div', [
h('span', 'Hello Kbone')
])
}
}).mount('#app')
Both Chameleon and Kbone aim to simplify cross-platform development, but they take different approaches. Chameleon offers a more comprehensive framework with its own DSL, while Kbone focuses on enabling web projects to run in WeChat Mini Program environments with minimal changes.
:dancer: 一款轻巧的渐进式微信小程序框架
Pros of tina
- Lightweight and focused on WeChat Mini Program development
- Simpler learning curve for developers familiar with Vue.js
- Better suited for smaller, less complex projects
Cons of tina
- Limited cross-platform support compared to kbone's broader capabilities
- Smaller community and ecosystem compared to kbone's backing by Tencent
- Less frequent updates and maintenance
Code Comparison
tina example:
Page.define({
data: {
message: 'Hello World'
},
onLoad() {
console.log('Page loaded')
}
})
kbone example:
import { h, createApp } from 'vue'
createApp({
render() {
return h('div', 'Hello World')
}
}).mount('#app')
tina focuses on a more WeChat Mini Program-specific approach, while kbone provides a more versatile framework for cross-platform development. tina's syntax is closer to traditional Mini Program development, whereas kbone leverages Vue.js conventions for a more familiar experience for web developers.
Both frameworks aim to simplify Mini Program development, but they cater to different project scales and developer preferences. tina is more suitable for developers who want a lightweight solution specifically for WeChat Mini Programs, while kbone offers greater flexibility and cross-platform capabilities for larger, more complex projects.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
kbone
kbone æ¯ä¸ä¸ªè´åäºå¾®ä¿¡å°ç¨åºå Web 端åæç解å³æ¹æ¡ã
ç®ä»
微信å°ç¨åºçåºå±æ¨¡åå Web 端ä¸åï¼æ们æ³ç´æ¥æ Web 端ç代ç æªå°å°ç¨åºç¯å¢å æ§è¡æ¯ä¸å¯è½çãkbone çè¯çå°±æ¯ä¸ºäºè§£å³è¿ä¸ªé®é¢ï¼å®å®ç°äºä¸ä¸ªéé å¨ï¼å¨éé å±é模æåºäºæµè§å¨ç¯å¢ï¼è®© Web 端ç代ç å¯ä»¥ä¸åä»ä¹æ¹å¨ä¾¿å¯è¿è¡å¨å°ç¨åºéã
è¿éæ个ç®åç代ç ç段ï¼https://developers.weixin.qq.com/s/R9Hm0Qm67Acdï¼å¯ä»¥ä½¿ç¨å¼åè å·¥å ·æå¼ççææã
å 为 kbone æ¯éè¿æä¾éé å¨çæ¹å¼æ¥å®ç°åæï¼æ以å®çä¼å¿å¾ææ¾ï¼
- 大é¨åæµè¡çå端æ¡æ¶é½è½å¤å¨ kbone ä¸è¿è¡ï¼æ¯å¦ VueãReactãPreact çã
- æ¯ææ´ä¸ºå®æ´çå端æ¡æ¶ç¹æ§ï¼å 为 kbone ä¸ä¼å¯¹æ¡æ¶åºå±è¿è¡å æ¹ï¼æ¯å¦ Vue ä¸ç v-html æ令ãVue-router æ件ï¼ã
- æä¾äºå¸¸ç¨ç dom/bom æ¥å£ï¼è®©ç¨æ·ä»£ç æ éå太大æ¹å¨ä¾¿å¯ä» Web 端è¿ç§»å°å°ç¨åºç«¯ã
- å¨å°ç¨åºç«¯è¿è¡æ¶ï¼ä»ç¶å¯ä»¥ä½¿ç¨å°ç¨åºæ¬èº«çç¹æ§ï¼æ¯å¦å live-player å ç½®ç»ä»¶ãåå åè½ï¼ã
- æä¾äºä¸äº Dom æ©å±æ¥å£ï¼è®©ä¸äºæ æ³å®ç¾å ¼å®¹å°å°ç¨åºç«¯çæ¥å£ä¹ææ¿ä»£ä½¿ç¨æ¹æ¡ï¼æ¯å¦ getComputedStyle æ¥å£ï¼ã
使ç¨
为äºå¯ä»¥è®©å¼åè å¯ä»¥æ´èªç±å°è¿è¡é¡¹ç®çæ建ï¼ä»¥ä¸æä¾äºä¸ç§æ¹å¼ï¼ä»»éå ¶ä¸å³å¯ï¼
ä½¿ç¨ kbone-cli å¿«éå¼å
对äºæ°é¡¹ç®ï¼å¯ä»¥ä½¿ç¨ kbone-cli
æ¥å建项ç®ï¼é¦å
å®è£
kbone-cli
:
npm install -g kbone-cli
å建项ç®ï¼
kbone init my-app
è¿å ¥é¡¹ç®ï¼æç § README.md çæå¼è¿è¡å¼åï¼
// å¼åå°ç¨åºç«¯
npm run mp
// å¼å Web 端
npm run web
// æ建 Web 端
npm run build
PSï¼é¡¹ç®åºäº webpack æ建ï¼å ³äº webpack æ¹é¢çé ç½®å¯ä»¥ç¹æ¤æ¥çï¼èå ³äºå°ç¨åºæ建ç¸å ³ç详ç»é ç½®ç»èå¯ä»¥åèæ¤ææ¡£ã
使ç¨æ¨¡æ¿å¿«éå¼å
é¤äºä½¿ç¨ kbone-cli å¤ï¼ä¹å¯ä»¥ç´æ¥å°ç°ææ¨¡æ¿ clone ä¸æ¥ï¼ç¶åå¨æ¨¡æ¿åºç¡ä¸è¿è¡å¼åæ¹é ï¼
é¡¹ç® clone ä¸æ¥åï¼æç §é¡¹ç®ä¸ README.md çæå¼è¿è¡å¼åã
æå¨é ç½®å¼å
æ¤æ¹æ¡åºäº webpack æ建å®ç°ï¼å¦æä½ ä¸æ³è¦ä½¿ç¨å®æ¹æä¾ç模æ¿ï¼æ³è¦æ´çµæ´»å°æ建èªå·±ç项ç®ï¼åæè æ¯æ³å¯¹å·²æç项ç®è¿è¡æ¹é ï¼åéè¦èªå·±è¡¥å 对åºé ç½®æ¥å®ç° kbone 项ç®çæ建ã
ä¸è¬éè¦è¡¥å 两个é ç½®ï¼
- æ建å°å°ç¨åºä»£ç ç webpack é ç½®
- ä½¿ç¨ webpack æ建ä¸ä½¿ç¨å°çç¹æ®æ件 mp-webpack-plugin é ç½®
ç¹æ¤å¯ä»¥æ¥çå ·ä½é ç½®æ¹å¼åæä½æµç¨ã
kbone-ui
kbone-ui æ¯ä¸ä¸ªè½åæ¶æ¯æ å°ç¨åº(kbone) å vue æ¡æ¶å¼åçå¤ç«¯ UI åºã
- å³å¯ä»¥åºäº
kbone
åæ¶å¼åå°ç¨åºå H5ï¼ä¹å¯ä»¥åç¬ä½¿ç¨å¼å H5 åºç¨ã - æ¯æ以 Vue è¯æ³æ¥æ¯æ H5 端åå°ç¨åºç«¯è¿è¡
- å¯¹é½ å¾®ä¿¡weui æ ·å¼ç»ä»¶
ææ¡£
æ´ä¸ºè¯¦ç»ç说æåæå¼ï¼å¯ç¹å»æ¥çææ¡£ã
PSï¼å¦æææ¡£æ æ³è®¿é®ï¼å¯å°è¯è®¿é®å¤ä»½ææ¡£éåã
é®é¢
æ¤æ¹æ¡è½ç¶å°æ´ä¸ª Web 端æ¡æ¶å å«è¿æ¥å¹¶æä¾äºéé å±ï¼ä½æ¯ä¹ä¸æ¯é¶å¼¹ï¼æ æ³æ»¡è¶³ææåºæ¯ï¼å ·ä½éå¶å¯åèé®é¢ææ¡£ãå¦æè¿éå°å ¶ä»é®é¢ï¼å¯å¨ issue ä¸åé¦ã
éæ©
ä¸å å ¶å®å·²ç»åºç°äºå¾å¤å ³äºåæç解å³æ¹æ¡äºï¼æ¯ä¸ªæ¹æ¡é½æèªå·±çä¼å£ï¼ä¸åå¨è½å¤å®ç¾è§£å³ææé®é¢çæ¹æ¡ãkbone ä¹ä¸æ ·ï¼å®çä¼å¿å¨ä¸é¢æå°è¿ï¼èå®çä¸è¶³ä¹æ¯å®çå®ç°åç带æ¥çãkbone æ¯ä½¿ç¨ä¸å®çæ§è½æèæ¥æ¢åæ´ä¸ºå ¨é¢ç Web 端ç¹æ§æ¯æã
æä»¥å ³äºæ§è½æ¹é¢ï¼å¦æä½ å¯¹å°ç¨åºçæ§è½ç¹å«èå»ï¼å»ºè®®ç´æ¥ä½¿ç¨åçå°ç¨åºå¼åï¼å¦æä½ ç页é¢èç¹æ°éç¹å«å¤ï¼éå¸¸å¨ 1000 èç¹ä»¥ä¸ï¼ï¼åæ¶è¿è¦ä¿è¯å¨èç¹æ°æ éä¸æ¶¨æ¶ä»ç¶æ稳å®ç渲ææ§è½çè¯ï¼å¯ä»¥å°è¯ä¸ä¸ä¸å éç¨éæ模æ¿è½¬è¯çæ¹æ¡ï¼å ¶ä»æ åµå°±å¯ä»¥ç´æ¥éç¨ kbone äºã
è´¡ç®è
æè°¢ä½ ä»¬ |
æ¥ç代ç è´¡ç®è§èã
交æµ
QQ 交æµç¾¤ï¼926335938
使ç¨ç¸å ³é®é¢å¯å¨ Kboneç¤¾åº åå¸
æ¡ä¾
License
Top Related Projects
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot