Ionic 環(huán)境配置搭建
1.安裝ionic/Install Ionic
首先您需要安裝Node.js. 其次, 安裝最新版本的cordova 和 ioniccommand-line tools. 通過(guò)參考Android和iOS官方文檔來(lái)安裝.
$npm install -g cordova ionic
2.通過(guò)Ionic創(chuàng)建一個(gè)項(xiàng)目
使用Ionic官方提供的現(xiàn)成的應(yīng)用程序模板,或一個(gè)空白的項(xiàng)目創(chuàng)建一個(gè)Ionic應(yīng)用。( Create an Ionic project using one of our ready-made app templates, or a blank one to start fresh.)
$ionic start myApp tabs
$ ionic start myApp blank ? ? ? ? ?空白文件
$ ionic start myApp tabs ? ? ? ? ? ?帶tabbar文件
$ ionic start myApp sidemenu ? ?帶側(cè)滑欄文件
3.運(yùn)行我們剛才創(chuàng)建的Ionic項(xiàng)目
使用Ionic tool 創(chuàng)建 ,測(cè)試,運(yùn)行你的apps(或者通過(guò)Cordova直接創(chuàng)建),如果要?jiǎng)?chuàng)建android應(yīng)用,把右側(cè)創(chuàng)建代碼中的ios改為android ( Use the Ionic tool to build, test, and run your apps (or use Cordova directly). Make sure to substitute ios with android to build for Android.)
Then, tryIonic Viewto share your apps with testers and clients, or to easily test on new devices.
$cdmyApp
$ionic platform add ios(android)
$ionic build ios(android)
$ionic emulate ios(android)
移除生成iOS目錄或Android目錄
$ionic platform rm(rmove) ios(android)