Ionic, esi sikhokelo sinokufakwa njani ku-Ubuntu 20.04

malunga ionic

Kwinqaku elilandelayo siza kujonga i-Ionic Framework, kunye nendlela yokufaka kwi-Ubuntu 20.04. Esi sikhokelo siza kuvumela abasebenzisi ukuba bazalisekise iiprojekthi kunye nezinye izikhokelo ezinje ngeAngular. Ionic ngumthombo ovulekileyo opheleleyo we-SDK yophuhliso lwesoftware eyenziweyo eyenziwe ngu-Drifty Co's Max Lynch, Ben Sperry, kunye no-Adam Bradley ngo-2013. Inguqulelo yokuqala yakhutshwa ngo-2013 kwaye yakhiwa ngaphezulu kwe-AngularJS kunye ne-Apache Cordova. Nangona kunjalo, uguqulelo lwamva nje lwakhiwe njengeseti yamacandelo ewebhu, ethi ivumela umsebenzisi ukuba akhethe ukwenza Angular, React okanye Vue.js iiprojekthi. Ikwavumela ukusetyenziswa kwezinto ze-Ionic ngaphandle kwesakhelo somsebenzisi.

Ionic ibonelela ngezixhobo kunye neenkonzo zokuphuhlisa i-hybrid desktop, usetyenziso lwewebhu kunye nenkqubela phambili ngokusekwe kuphuhliso lwangoku lwewebhu kunye neetekhnoloji. Ngale nto, ubuchwepheshe bewebhu obufana neCSS, i-HTML5 kunye neSass bunokusetyenziswa. Ngale nkqubo-sikhokelo sinokuphuhlisa usetyenziso kunye nobuchwephesha bewebhu obuhambelana ne-iOS, i-Android okanye iwebhu uqobo. Ikwabonelela ngesixhobo esinamandla se-CLI esiya kuthi sikwazi ngaso ukulawula nokwenza iiprojekthi.

Iimpawu ngokubanzi zeIonic

  • Esi sikhokelo simahla kunye nomthombo ovulekileyo. Inika ilayibrari yezixhobo zomsebenzisi ezilungiselelwe ukuhamba kunye nezixhobo, ezinokuthi zenze izicelo ezikhawulezayo nezisebenzayo.
  • Ionic isebenzisa iCordova, kwaye kutshanje ii-plug-ins zokufumana ukufikelela kwimisebenzi yenkqubo yokusebenza njengeGPS, ikhamera, isibane, njl.
  • Abasebenzisi banokwenza izicelo zabo kwaye bazenzele i-Android, iOS, Windows, desktop (kunye ne-Electron) okanye iiphequluli zanamhlanje.
  • Ionic kubandakanya ukuhambisa izinto, typography, okanye umxholo osisiseko owandisiweyo.
  • Xa usebenzisa Izixhobo zewebhu, Ionic ibonelela ngezinto zesiko kunye neendlela zokunxibelelana nazo. Elinye lala macandelo, ukukrola okubonakalayo, kuvumela abasebenzisi ukuba baskrole uluhlu lwamawaka ezinto ngaphandle kwempembelelo yokusebenza. Elinye icandelo, i-Tabs, lenza ujongano lwetabheli oluxhasa indlela yohlobo lwasekhaya kunye nolawulo lobume bembali.
  • Ukongeza kwi-SDK, Ionic ikwabonelela Abaphuhlisi beenkonzo banokusebenzisa ukwenza amanqakunjengokuhanjiswa kwekhowudi okanye ukwakha okuzenzekelayo.
  • Kwakhona ibonelela nge IDE yayo eyaziwa ngokuba yiIonic Studio.
  • Ikwabonelela ujongano lwe Umgca wokuyalela (CLIukwenza iiprojekthi. I-CLI ikwavumela abaphuhlisi ukuba bongeze iiplagi ezongeziweyo zeCordova kunye neephakeji, zenze ukuba izaziso zityhale, zivelise ii-icon zeapp, zibonakalise izikrini, kwaye zenze ii-binaries zemveli.

Faka i-Ionic kwi-Ubuntu 20.04

Ukufakwa kwesi sikhokelo kulula. Ukuqala sifuna ukuvula i-terminal (Ctrl + Alt + T) kunye hlaziya iinkqubo zethu zenkqubo:

sudo apt update; sudo apt upgrade

Emva koko siya kuthi faka ezinye iiphakheji eziyimfuneko. Kwisiphelo esinye kuya kufuneka sisebenzise lo myalelo:

faka ukuxhomekeka

sudo apt install curl gnupg2 wget git

Inyathelo elilandelayo liza kuba faka iNodeJS. Lo mzekelo ndiwuvavanyile ngohlobo 14.x. Ukufaka le nguqulo, Siza kuqala ngokudibanisa indawo yokugcina efanelekileyo:

yongeza repo nodejs

curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -

Emva koko sinako instalar NodeJS usebenzisa lo myalelo:

faka ii-nodejs

sudo apt install nodejs

Ionic ifuna Apache Cordova. Kuya kucaciswa ukuba le siseti yezixhobo ze-API ezivumela umphuhlisi wesicelo esiphathwayo, esebenzisa iJavaScript, ukufikelela kwimisebenzi yendalo yesixhobo, njengekhamera okanye isantya.

Emva kokufaka iNodeJS, sinako faka icordova ukubaleka:

ufakelo lweCordova

sudo npm install -g cordova

Okwangoku, sinokudlulela phambili faka i-Ionic usebenzisa npm:

ufakelo usebenzisa npm

sudo npm i -g @ionic/cli

Emva kofakelo, sinako jonga ingxelo efakiweyo ngomyalelo:

Inguqulelo yeionic

ionic -v

Isicelo somzekelo

Ukwazi ukuba ufakelo lwenziwe ngokuchanekileyo, sinokuqala ngokudala umzekelo omncinci wesicelo. Ukwenza oku, kuya kufuneka kuphela sebenzisa lo myalelo ulandelayo yenza umzekelo:

ionic start

Xa usebenzisa lo myalelo Kuya kufuneka uchaze ukuba loluphi uhlobo lweprojekthi ofuna ukuyenza. Kulo mzekelo ndikhethe iAngular. Ukongeza, kuya kufuneka unike iprojekthi yakho igama kwaye ukhethe itemplate. Konke oku kuya kufuneka ukhethe kwiscreen esifana noku kulandelayo:

ionic ukuqala

Emva kokusetha, Kuya kwenziwa ifolda enegama esilinike iprojekthi. Fikelela kule folda ukuze ubone ubume beprojekthi.

imiyalelo yokuqalisa yomzekelo

Ukuze ukwazi jonga iprojekthi, kwisiphelo esinye siya kwenza lo myalelo:

qalisa iseva

ionic serve --host 0.0.0.0 --port 8000

Ngalo myalelo siya kuvumela nawuphi na umamkeli ukuba afikelele kwizibuko i-8000.

Xa yonke into oyifunayo ilayishiwe, vula isikhangeli sakho sewebhu kwaye uye ku http://localhost:8000 o http://IP-de-tu-servidor:8000 kwaye uza kubona iphepha lomzekelo elisandula ukwenziwa.

umzekelo wesicelo

Ionic sisakhelo sangoku esivumela ukuba siphuhlise izicelo ezinqamlezayo ngendlela elula kunye nenhle. Inokufumaneka Ulwazi oluthe kratya kunye namaxwebhu malunga nokufakwa kwayo kunye nokusebenza kwayo iwebhusayithi yeprojekthi.


Umxholo wenqaku uyabambelela kwimigaqo yethu imigaqo yokuziphatha yokuhlela. Ukuxela impazamo cofa apha.

Yiba ngowokuqala ukuphawula

Shiya uluvo lwakho

Idilesi yakho ye email aziyi kupapashwa.

*

*

  1. Uxanduva lwedatha: UMiguel Ángel Gatón
  2. Injongo yedatha: Ulawulo lwe-SPAM, ulawulo lwezimvo.
  3. Umthetho: Imvume yakho
  4. Unxibelelwano lwedatha: Idatha ayizukuhanjiswa kubantu besithathu ngaphandle koxanduva lomthetho.
  5. Ukugcinwa kweenkcukacha
  6. Amalungelo: Ngalo naliphi na ixesha unganciphisa, uphinde uphinde ucime ulwazi lwakho.

bool(yinyani)