Idan ya zo ga fasahar tufatar da yara, akwai salo da yawa da ya kamata a yi la'akari da su, suna mai da shi aiki mai daษi da ban sha'awa. A cikin wannan labarin, za mu bincika wasu shahararrun salon yara, dalla dalla dalla dalla dalla dalla dalla dalla dalla dalla dalla dalla dalla dalla dalla dalla da wadannan salon, har ma da samar da wasu ingantattun shawarwari kan yadda za a iya haษawa da daidaita sassa daban-daban na tufafi don gamawa mai kyau.
Nau'inAbubakar
An warware: nau'in tsararrun abubuwa
A cikin duniyar shirye-shirye, yanayin da aka saba ci karo da shi shine buฦatuwar tsara jerin abubuwa. Wannan na iya zama kamar mai ban tsoro da farko, musamman a cikin yare mai ฦima kamar Nau'in cuta. Duk da haka, tare da tsarin da ya dace, wannan aikin zai iya zama aikin da za a iya sarrafawa. Wannan ya wuce rarrabuwar haruffa ko lambobi kawai; muna zurfafa zurfafa cikin rarrabuwa ta takamaiman kaddarori ko kaddarorin abubuwa da yawa na tsararrun abu.
Maganin matsalar yawanci ya ฦunshi amfani da hanyar tsararru () a haษe da tsarin nau'in TypeScript. Anan ga hoto mai sauri na yadda zaku iya ware tsararrun abubuwa ta hanyar 'suna'.
let arr = [{name: 'Joe'}, {name: 'Bob'}, {name: 'Alice'}]; arr.sort((a, b) => a.name.localeCompare(b.name));
A cikin misalin da ke sama, muna amfani da in-built JavaScript Hanyar Array.prototype.sort a haษe tare da aikin kwatance dangane da wurare.
An warware: yadda ake bincika idan fayil ya wanzu lua
Tabbas, ga daftarin labarin ku:
Fahimtar ฦarfi da juzu'in shirye-shiryen Lua yana ba da ฦima mai mahimmanci wajen sarrafa fayiloli ta hanyar da ta dace. Wani muhimmin al'amari da ya kamata a lura dashi shine ikonsa don bincika idan akwai fayil ษin. Wannan aikin yana da mahimmanci wajen guje wa kurakurai ko sakamakon da ba a yi niyya ba yayin ayyukan fayil. A yau, muna nufin rarraba tsarin tabbatar da wanzuwar fayil ta amfani da Lua.
An warware: useref react
Anan ga yadda zaku iya tsara labarin da kuka nema game da amsa "useref":
React sanannen ษakin karatu ne na duniya don ฦirฦirar mu'amalar masu amfani, musamman aikace-aikacen shafi ษaya. Labura ce mai sauฦi da sassauฦa da aka tsara don haษaka ฦwarewar mai amfani. Ci gaban yanar gizo ya kai sabon sa'o'i tare da fasalulluka kamar Hooks wanda React ya kawo. ฦayan irin wannan muhimmin fasalin, ko za ku iya la'akari da shi, ฦugiya da React ya samar shine amfaniRef. UseRef ana amfani da shi gabaษaya don samun dama ga nodes na DOM ko abubuwan React.
An warware: font madalla angular
Tabbas, ga dogon labarin game da Font Awesome Angular:
Font Awesome babban ษakin karatu ne na icon wanda za'a iya amfani dashi a cikin aikace-aikacen mu na Angular. Haษa Font Awesome yana ba masu haษaka damar zuwa ษaruruwan madaidaitan gumaka masu ฦima waษanda za a iya keษance su da CSS. Wannan yana da amfani musamman tunda yana ba mu damar amfani da gumaka masu kyau ba tare da buฦatar dogaro da yawa akan zane-zane ko fayilolin hoto ba. Wannan na iya sauฦaฦa da gaske kulawa da tsara ayyukan ku na Angular. A cikin wannan jagorar, za mu koyi yadda ake haษa Font Awesome cikin aikace-aikacen ku na Angular mataki-mataki.
An warware: akan girman taga
Mayar da taga yana iya zama kamar aiki mara mahimmanci a cikin ci gaban yanar gizo, amma a zahiri yana da alaฦa ฦดan ra'ayoyi daga JavaScript da Typescript, kuma yana taka muhimmiyar rawa wajen tabbatar da ฦira mai dacewa da mai amfani. A cikin mahallin UI/UX mai ฦarfi, aikin 'taga girman girman' yana da mahimmanci. Misalai na yau da kullun na iya haษawa da shingen gefe wanda ke raguwa akan girman taga don ba da sarari karatu mara kyau, ko hoton hoton da ke daidaita kanta don hana murdiya. Ana yin gyare-gyaren a hankali ta hanyar sauraron taron sake girman taga.
An warware: watsi da node_modules
A matsayinka na mai haษakawa, mai yiwuwa ka yi tafiya a cikin babban fayil 'node_modules' a cikin ayyukanka. Wannan muhimmin bangare ne na duniyar JavaScript da TypeScript, musamman a cikin ayyukan da ke amfani da Node.js. Waษannan '' node_modules '' suna kama da DNA don aikinku, gami da duk ษakunan karatu ko abubuwan dogaro da lambar ku ke buฦatar aiwatarwa daidai. Matsalar ita ce wannan babban fayil na iya girma cikin sauri cikin girma, yana mai da aikin ku nauyi, musamman dangane da tsarin sarrafa sigar. Bugu da ฦari, za a iya samun ษimbin rikice-rikice na sigar rubutu idan ba a kula da su daidai ba.
An warware: ts queryselectorall as htmlelement
A cikin al'ummar yau inda bayanai suka zama ruwan dare, mu'amala da takaddun HTML ba banda bane. Kowane shafin yanar gizon sararin samaniya an gina shi akan HTML, ฦirฦirar ragamar labyrinthine na abubuwa da tags. Makullin kewayawa ta wannan ragar cikin tsari da tsari shine ta hanyar amfani da na'urar tambayaSelectorAll Hanyar a JavaScript ko, a cikin yanayinmu a nan, TypeScript. A yau, za mu zurfafa zurfafa cikin yin amfani da damar tambayarSelectorAll azaman HTMLElement a cikin TypeScript.
An warware: ts juyi tsararru
Mayar da tsararru a cikin Rubutun Rubutun ya ฦunshi ainihin canza tsarin abubuwan da ke cikin tsararru daga jerin abubuwan zuwa akasin haka. Wannan tsari wani muhimmin fanni ne mai mahimmanci wajen sarrafa tsararraki, don haka, zai iya zama mai matuฦar taimako wajen warware matsaloli daban-daban.
The Nau'in cuta harshe ya ฦunshi ginanniyar hanyar da aka gina don juyar da tsararraki, wanda aka sani da aikin array.reverse(). Lallai, ta amfani da wannan aikin, muna iya juyar da kowane tsararru a cikin Typescript ba tare da wahala ba.
Don kwatanta amfani da shi, yi la'akari da tsararrun samfurin:
let array = [1, 2, 3, 4, 5];
Zamu iya juyar da wannan tsararru ta amfani da aikin array.reverse() kamar haka:
array = array.reverse();
Wannan aiki zai juyar da tsarin abubuwan da ke cikin asalin tsararru ta yadda jerin sa ya zama akasin abin da yake kafin a yi aikin.