Convert Figma logo to code with AI

dcloudio logouni-app

A cross-platform framework using Vue.js

39,886
3,613
39,886
1,012

Top Related Projects

7,994

🐰 Rax is a progressive framework for building universal application. https://rax.js.org

35,310

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

25,724

Quasar Framework - Build high-performance VueJS user interfaces in record time

A framework for building native applications using React

Quick Overview

uni-app is a cross-platform framework for developing mobile and web applications using Vue.js. It allows developers to write once and deploy to multiple platforms, including iOS, Android, H5, and various mini-program ecosystems like WeChat and Alipay.

Pros

  • Cross-platform development with a single codebase
  • Large ecosystem with extensive plugin support
  • Seamless integration with Vue.js and its ecosystem
  • High performance with native rendering capabilities

Cons

  • Learning curve for developers new to Vue.js or cross-platform development
  • Limited customization options for platform-specific features
  • Dependency on the uni-app ecosystem for certain functionalities
  • Potential performance overhead compared to native development

Code Examples

  1. Creating a basic page:
<template>
  <view class="content">
    <text>Hello uni-app!</text>
  </view>
</template>

<script>
export default {
  data() {
    return {}
  },
  methods: {}
}
</script>

<style>
.content {
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
  1. Making an API request:
uni.request({
  url: 'https://api.example.com/data',
  method: 'GET',
  success: (res) => {
    console.log(res.data);
  },
  fail: (err) => {
    console.error(err);
  }
});
  1. Navigation between pages:
// Navigate to a new page
uni.navigateTo({
  url: '/pages/detail/detail?id=1'
});

// Go back to the previous page
uni.navigateBack();

Getting Started

  1. Install Vue CLI and the uni-app plugin:

    npm install -g @vue/cli
    vue add @dcloudio/vue-cli-plugin-uni
    
  2. Create a new uni-app project:

    vue create -p dcloudio/uni-preset-vue my-project
    
  3. Run the project:

    cd my-project
    npm run dev:h5
    

This will start a development server for the H5 version of your app. You can use different commands to run on other platforms, such as npm run dev:mp-weixin for WeChat mini-program.

Competitor Comparisons

7,994

🐰 Rax is a progressive framework for building universal application. https://rax.js.org

Pros of Rax

  • Lightweight and performant, optimized for mobile development
  • Supports multiple rendering targets (Web, Weex, Mini-programs)
  • Backed by Alibaba, with strong community support and ecosystem

Cons of Rax

  • Steeper learning curve compared to Uni-app
  • Less comprehensive documentation and tutorials
  • Smaller plugin ecosystem than Uni-app

Code Comparison

Rax component:

import { createElement, render } from 'rax';
import View from 'rax-view';

function App() {
  return <View>Hello, Rax!</View>;
}

render(<App />);

Uni-app component:

<template>
  <view>Hello, Uni-app!</view>
</template>

<script>
export default {
  name: 'App'
}
</script>

Key Differences

  • Rax uses a React-like syntax, while Uni-app uses Vue-style components
  • Rax focuses on performance and flexibility, Uni-app emphasizes ease of use and cross-platform compatibility
  • Rax has a more modular approach, allowing developers to choose specific packages, while Uni-app provides a more integrated solution

Use Cases

  • Rax: Ideal for complex, high-performance mobile applications, especially within the Alibaba ecosystem
  • Uni-app: Better suited for rapid development of cross-platform apps with a gentler learning curve
35,310

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/

Pros of Taro

  • Supports more frameworks (React, Vue, Nerv) compared to uni-app's Vue-only approach
  • Better TypeScript support and type checking
  • More active community and frequent updates

Cons of Taro

  • Steeper learning curve, especially for developers new to React
  • Less comprehensive documentation compared to uni-app
  • May have compatibility issues with some native APIs

Code Comparison

Taro (React):

import { Component } from 'react'
import { View, Text } from '@tarojs/components'

export default class Index extends Component {
  render() {
    return (
      <View className='index'>
        <Text>Hello, World!</Text>
      </View>
    )
  }
}

uni-app (Vue):

<template>
  <view class="content">
    <text>Hello, World!</text>
  </view>
</template>

<script>
export default {
  name: 'App'
}
</script>

Both frameworks aim to create cross-platform applications, but Taro offers more flexibility in terms of framework choice and has better TypeScript integration. uni-app, on the other hand, provides a more straightforward development experience with its Vue-based approach and comprehensive documentation. The choice between the two depends on the developer's familiarity with React or Vue, and the specific requirements of the project.

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

Pros of Ionic Framework

  • Larger community and ecosystem, with more third-party plugins and resources
  • Better documentation and learning resources
  • More mature and established framework with a longer track record

Cons of Ionic Framework

  • Steeper learning curve, especially for developers new to Angular or React
  • Larger bundle sizes, which can impact app performance
  • Less native-like look and feel compared to Uni-app's closer adherence to platform-specific UI

Code Comparison

Ionic Framework (Angular):

import { Component } from '@angular/core';

@Component({
  selector: 'app-home',
  template: '<ion-content><h1>Hello Ionic!</h1></ion-content>'
})
export class HomePage {}

Uni-app:

<template>
  <view>
    <text>Hello Uni-app!</text>
  </view>
</template>

<script>
export default {
  // Component logic here
}
</script>

Both frameworks aim to simplify cross-platform app development, but they take different approaches. Ionic Framework offers a more web-centric development experience with a focus on Angular or React, while Uni-app provides a Vue-like syntax and aims for a more native feel. The choice between them depends on the developer's background, project requirements, and target platforms.

25,724

Quasar Framework - Build high-performance VueJS user interfaces in record time

Pros of Quasar

  • More comprehensive ecosystem with built-in components and tools
  • Better documentation and community support
  • Supports both Vue 2 and Vue 3

Cons of Quasar

  • Steeper learning curve due to its extensive feature set
  • Larger bundle size, which may impact performance on low-end devices

Code Comparison

uni-app:

<template>
  <view class="content">
    <text>{{ title }}</text>
  </view>
</template>

<script>
export default {
  data() {
    return {
      title: 'Hello'
    }
  }
}
</script>

Quasar:

<template>
  <q-page class="flex flex-center">
    <q-btn color="primary" label="Hello" />
  </q-page>
</template>

<script>
export default {
  name: 'PageIndex'
}
</script>

Key Differences

  • uni-app uses a custom <view> component, while Quasar uses standard HTML elements with its own components like <q-page> and <q-btn>
  • Quasar provides built-in styling and theming options, evident in the color="primary" attribute
  • uni-app's syntax is closer to standard Vue, making it easier for Vue developers to adopt

Both frameworks aim to simplify cross-platform development, but Quasar offers a more feature-rich environment at the cost of complexity, while uni-app focuses on ease of use and familiarity for Vue developers.

A framework for building native applications using React

Pros of React Native

  • Larger community and ecosystem, with more third-party libraries and resources
  • Better performance for complex applications due to native rendering
  • Stronger corporate backing from Facebook, ensuring long-term support

Cons of React Native

  • Steeper learning curve, especially for developers new to React
  • More complex setup and configuration process
  • Less consistent cross-platform UI, requiring platform-specific adjustments

Code Comparison

React Native:

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

const App = () => (
  <View style={styles.container}>
    <Text>Hello, React Native!</Text>
  </View>
);

uni-app:

<template>
  <view class="container">
    <text>Hello, uni-app!</text>
  </view>
</template>

<style>
.container { /* styles */ }
</style>

Key Differences

  • React Native uses JSX syntax, while uni-app uses Vue-like template syntax
  • React Native requires separate styling with StyleSheet, uni-app uses Vue-style CSS
  • uni-app offers a more unified development experience across platforms
  • React Native provides more granular control over native components

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

uni-app

简体中文 | English

uni-app 是一个使用 Vue.js 开发小程序、H5、App的统一前端框架。官网地址:https://uniapp.dcloud.io

开发者使用 Vue 语法编写代码,uni-app 框架将其编译到 小程序(微信/支付宝/百度/字节跳动/QQ/快手/钉钉/小红书)、App(iOS/Android)、H5等多个平台,保证其正确运行并达到优秀体验。

uni-app的特点

  • 开发者和案例更多:HBuilder装机量800万台,开发者社区月活百万,70多个QQ微信群承载10万人。案例众多,uni统计月活超10亿(详见)
  • 性能更高(见评测)
  • 更丰富的周边生态,插件市场数千款插件
  • 提供比小程序原生开发更好的开发体验、更高的工程化效率
  • 跨端抹平度更完善,且各端特色发挥更灵活,可真正实现一套代码多端覆盖,无需各端多头维护升级
  • 权威认可:阿里小程序官方工具内置uni-app(详见)、腾讯课堂官方自制uni-app培训视频(详见)

扫码体验

开发一次,编译到14个平台。依次扫描14个二维码,亲自体验最全面的跨平台效果!

注: 某些平台不能提交简单demo,补充了一些其他功能。

快速开始

uni-app支持通过vue-cli命令行、HBuilderX可视化界面两种方式快速创建项目:

项目案例

案例展示:uniapp.dcloud.io/case

欢迎提交你的应用,uni-app案例征集

需求墙

uni-app计划支持的功能点,会在需求墙上进行展示,征集开发者的投票意见,前往投票。

更新日志

uni-app一直保持高频的更新迭代,详见正式版更新日志、Alpha版更新日志。

论坛

由于DCloud有70多个QQ、微信群,官方已无法维护更多交流群。请开发者到官方论坛交流:https://ask.dcloud.net.cn/explore/ 。论坛提供了比issues更专业的工具服务。

插件市场

uni-app有丰富的插件生态,众多开发者提交了数千款组件、sdk、项目模板,详见:https://ext.dcloud.net.cn/

除了众多三方ui库,官方还提供了uni-ui,在性能和跨端兼容方面有更强的优势。详见:https://ext.dcloud.net.cn/plugin?id=55

现有项目如何迁移到uni-app体系

常见疑问

  • 问:不同端有不同的需求、不同的特色,登录支付也不一样,如何统一?

  • 答:差异部分使用条件编译。uni-app提供了灵活强大的条件编译。可以完美处理复用部分和差异部分。真正一套工程源码。当业务升级时,不再需要多端维护。如果多端维护,经常会因为某些端的流量不大,就一直拖延无法让那些用户享受到最新服务。另外登录支付在客户端部分,已经被uni-app统一成一样的api了。

  • 问:多端是不是一种妥协,是否会造成性能下降?

  • 答:good question。多端且不影响性能,确实很难,但uni-app做到了。在h5端,它的性能、包体积与直接使用vue.js开发一致; 在小程序端,它的性能比大多数开发框架更好,uni-app底层自动处理的setdata差量同步机制,比开发者手动写setdata更好,就像使用vue.js更新界面比手动写js修改dom更高效一样; 在App,uni-app支持webview渲染和原生渲染双引擎,启用原生渲染时,css写法受限,但性能是很接近原生开发的效果的,在当前的手机环境下,千万日活以下的应用在App使用uni-app也不会遇到任何压力。当然也可以在已经做好的原生App中将部分页面改为uni-app实现; 此外,我们会把很多跨端处理放在编译期完成的,这样会减少对运行期的效率影响。

  • 问:不做多端,是不是不需要uni-app?

  • 答:不是。大量开发者用uni-app只做一个端,详见案例。对于开发者而言,一个优秀工具在手,做什么都不愁。

  • 问:uni-app以后会不会变更开源协议,转向收费?

  • 答:官方承诺永远不会变更开源协议。无论HBuilderX、uni-app、App,面向中国人永久免费。

更多资料

贡献指南

如果你想参与贡献,请先阅读贡献指南。

NPM DownloadsLast 30 Days