GithubHelp home page GithubHelp logo

soybeanjs / vue3-capacitor-app Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 1.0 15 KB

a template, based on Vite3, Vue3, Capacitor, TS, NutUI and UnoCss, which can complier to android、ios and h5. 基于Vite3, Vue3, Capacitor, TS , NutUI 和UnoCss的App模版,可以编译成IOS、安卓和H5

JavaScript 26.40% TypeScript 16.41% HTML 4.87% CSS 46.56% Vue 5.76%

vue3-capacitor-app's Introduction

Vue3 Capacitor App

介绍

基于 Vite3 + Vue3 + Capacitor + TS + Pinia + NutUI + Unocss 的 App 模版。可以编译成 Android 和 IOS 原生 APP

开始

安装依赖

pnpm i

打包构建

pnpm build

编译到 IOS 或者 Android

IOS

pnpm cap add ios # 添加ios原生APP项目(保证已经打包构建出了 dist 目录)
cd ./ios/App # 进入IOS项目主目录
pod install # 安装IOS依赖

m1 处理器的苹果 pod install 安装失败时:

sudo arch -x86_64 gem install ffi #未安装 ffi,先执行
arch -x86_64 pod install # 代替 pod install
cd ../../ # 回到主项目根目录
pnpm cap open ios

选择 IOS 模拟器,编译

Android

请提前配置好安卓环境,安装好 SDK

pnpm cap add android # 添加Android原生APP项目(保证已经打包构建出了 dist 目录)
pnpm cap open android ## 打开Android Studio后,第一次加载有点慢(点击build查看进度)
  • 点击 Android Studio 右上角的 Sync Project with Gradle Files,成功后,选择设备(没有时添加个虚拟机或者连接真机)
  • 设备配置好后,确认设备按钮左边相邻按钮是否有绿色的 App,如果没有就重启一下 Android Studio
  • 点击右上角的 Run

本地开发模式热更新

pnpm dev # 本地直接运行

获取局域网 ip 地址(非 localhost), 例如:http://192.168.31.80:5173

将地址替换 capacitor.config.ts 的 server 的 url 属性

更新配置到原生 APP 项目:

pnpm cap sync

利用 XCode 或者 Android Studio 编译到设备上

本地更改代码,保存,自动热更新

vue3-capacitor-app's People

Contributors

honghuangdc avatar

Stargazers

Sakura Yumine avatar  avatar  avatar  avatar Whisperer avatar yanbowen avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gavinlucky

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.