Cov txheej txheem:

Muab koj thawj daim ntawv thov rau npe ua: 8 Kauj Ruam
Muab koj thawj daim ntawv thov rau npe ua: 8 Kauj Ruam

Video: Muab koj thawj daim ntawv thov rau npe ua: 8 Kauj Ruam

Video: Muab koj thawj daim ntawv thov rau npe ua: 8 Kauj Ruam
Video: txhob hnov qab kuv lub npe - Bee lee [Official MV] 2022-23 2024, Hlis ntuj nqeg
Anonim
Deploy Your First To-Do List Application
Deploy Your First To-Do List Application

Yog tias koj tshiab rau coding lossis muaj qee qhov keeb kwm yav dhau los, koj yuav xav tsis thoob tias yuav pib kawm qhov twg. Koj yuav tsum kawm paub yuav ua li cas, dab tsi, nyob qhov twg chaws thiab tom qab ntawd, thaum cov cai tau npaj lawm, yuav siv nws li cas kom pom tag nrho.

Zoo, xov xwm zoo yog tias coding tsis nyuaj.

Lub Hom Phiaj Cov Neeg Tuaj Saib: Phau ntawv qhia no yog npaj rau cov pib tshiab uas xav pib txoj haujlwm hauv kev txhim kho web, muaj kev nkag siab txog lub vev xaib thev naus laus zis feem ntau.

Tsim Sijhawm: 90 feeb.

Nyuaj: Yooj yim.

Kauj Ruam 1: Peb Yuav Tsim Dab Tsi?

Thaum kawg ntawm qhov kev qhia no peb yuav:

  • Tsim kom yooj yim To-Do List Web Application siv HTML5.
  • Sib koom Bootstrap nrog peb lub app ntxiv saib zoo thiab ua kom nrawm.
  • Siv JavaScript thiab JQuery lub tsev qiv ntawv los ntxiv qee qhov kev coj ua zoo rau peb daim ntawv thov.
  • Muab peb daim ntawv thov tso rau hauv huab siv Ziet/tam sim no.

Hauv Kev Ua:

Kauj ruam 2: Taw qhia rau HTML, Bootstrap, JavaScript & JQuery

HTML yog dab tsi?

Hyper Text Markup Language (HTML) tuaj yeem xav tias yog "hom lus hauv internet". HTML yog tus qauv cim lus uas siv los tsim cov nplooj ntawv web. Nws tau xub tsim los rau kev sib qhia cov ntaub ntawv tshawb fawb. Kev hloov kho rau HTML ntau xyoo ua rau nws haum rau piav qhia ntau lwm hom ntaub ntawv uas tuaj yeem nthuav tawm ua cov vev xaib hauv is taws nem.

Tsuas yog qhov xav tau uas xav tau los tso saib nplooj ntawv HTML yog lub vev xaib, xws li Microsoft Internet Explorer (IE), Mozilla Firefox, Google Chrome, lossis Apple Safari.

Bootstrap yog dab tsi?

Bootstrap yog qhov nrov tshaj plaws HTML, CSS, thiab lub hauv paus JavaScript rau kev tsim cov lus teb, mobile thawj lub vev xaib. Bootstrap yog qhov qhib qhov haujlwm tsim los ntawm Twitter. nws suav nrog CSS chav kawm uas tuaj yeem siv rau cov ntsiab lus los ua kom lawv zoo ib yam thiab JavaScript code uas ua tiav kev txhim kho ntxiv.

JavaScript yog dab tsi?

JavaScript yog hom lus programming uas siv rau cov neeg siv khoom sab hauv kev thov hauv web. JavaScript code tau khiav los ntawm qhov browser thiab tso cai rau web application programmers los tsim cov vev xaib muaj zog, xws li cov khoom siv uas qhia lossis zais tsis zoo, hloov pauv qhov tsos, thiab siv tau cov neeg siv nkag mus.

JQuery yog dab tsi?

JQuery tau nrawm, me me, thiab muaj ntau lub tsev qiv ntawv JavaScript, nws ua rau tej yam xws li HTML cov ntaub ntawv hla mus los, thiab kev tswj hwm, kev teeb tsa cov xwm txheej, ua kom yooj yim dua.

Txhua lub zog ntawm JQuery tau nkag los ntawm JavaScript, yog li muaj kev nkag siab zoo ntawm JavaScript, yog qhov tseem ceeb rau kev nkag siab, teeb tsa, thiab debugging koj cov cai.

Yog Xav Paub Ntxiv:

HTML

JavaScript

JQuery

Bootstrap

Kauj Ruam 3: Koj Thawj Nplooj Ntawv Nrog HTML

Koj Thawj Nplooj Ntawv Nrog HTML
Koj Thawj Nplooj Ntawv Nrog HTML

STEP1: tsim daim nplaub tshev tshiab:

mkdir yooj yim-todolist

KAUJ RUAM 2: tsim cov ntawv tshiab hauv cov ntawv yooj yim-todolist thiab npe nws index.html.

cd yooj yim-todolist

kov index.html

STEP3: ntxiv cov cai hauv qab no rau index.html.

To-Do-List

Kuv To-Do-List

STEP4: Qhib qhov index.html ntawm koj tus browser.

Koj yuav pom Kuv To-Do-List tau tso tawm (saib daim duab saum toj no).

Kauj ruam 4: Ntxiv Bootstrap

Ntxiv Bootstrap
Ntxiv Bootstrap

Hauv ntu no peb yuav ntxiv kev txhawb nqa Bootstrap rau peb nplooj ntawv.html nplooj ntawv, txhawm rau ntxiv nrawm, thiab ua kom zoo nkauj rau To-Do List App.

Daim ntawv ceeb toom: Hauv daim ntawv thov no peb yuav siv Bootstrap 3, koj siv lwm yam CSS qauv, zoo li Semantic UI.

STEP1: ntxiv Bootstrap CSS cov ntaub ntawv hauv lub taub hau tag:

KAUJ RUAM 2: ntxiv Bootstrap thiab JQuery CDN cov ntawv sau thaum kawg ntawm lub cev tag:

STEP3: Qhib index.html ntawm koj tus browser.

Nrog koj zoo siab, peb ua tiav ntxiv Bootstrap kev txhawb nqa rau peb nplooj ntawv hauv ob peb kauj ruam.

Kauj ruam 5: Ua kom tiav UI

Ua kom tiav UI
Ua kom tiav UI

Tom qab peb ua tiav ntxiv Bootstrap kev txhawb nqa rau peb app. Tam sim no cia mus thiab sib tw UI (Tus Neeg Siv Khoom Siv) kom cia tus neeg siv ntxiv cov haujlwm tshiab. Cov To-Do cov npe yuav tuaj yeem ntxiv cov khoom tshiab rau hauv cov npe, ntxiv rau tshem tawm cov khoom uas twb muaj lawm.

KAUJ RUAM 1: ntxiv cov cai hauv qab no rau index.html.

Ntxiv Kev Ua Haujlwm Tshiab Ntxiv Ntshiab Txhua!

Kuv Daim Ntawv Teev Npe

KAUJ RUAM 2: qhib cov ntawv index.html ntawm koj tus browser.

Kauj Ruam 6: Ntxiv Logic rau App

Ntxiv Logic rau App
Ntxiv Logic rau App

Thaum koj nkag mus rau lub luag haujlwm npe thiab nyem rau ntawm Add button, tsis muaj dab tsi tshwm sim tam sim no. Wb kho qhov ntawd.

Txog qhov kawg ntawm cov kauj ruam no peb yuav tig peb qhov index.html mus rau nplooj ntawv hloov pauv, yog li nws yuav coj tus yam ntxwv rau cov neeg siv kev sib cuam tshuam.

KAUJ RUAM 1: tsim daim nplaub tshev tshiab sab hauv yooj yim-todolist, npe nws js thiab cov ntaub ntawv tshiab lub npe nws script.js hauv daim nplaub tshev ntawd:

mkd yus

cd js kov script.js

KAUJ RUAM 2: txuas cov ntawv.js rau index.html los ntawm kev ntxiv cov cai hauv qab no ntawm qhov kawg ntawm lub taub hau:

KAUJ RUAM 3: ntxiv cov cai hauv qab no rau cov ntawv script.js

$ (ntawv).ready (() => {

var cov haujlwm = 0 $ ("#tshem tawm tag nrho"). hide (); / * ntxiv tus neeg ua haujlwm tshiab */ $ ("#ntxiv"). ntawm ("nyem", (kev tshwm sim) => {event.preventDefault (); event.stopPropagation (); var val = $ ("input"). val (); yog (val! == "") {cov haujlwm += 1; var elm = $ ("

  • "); $ ("#mylist "). append (elem); $ (" input "). val (" "); / * tshem tawm tus neeg ua haujlwm tshwj xeeb * / $ (". text-right "). ((" clikc ", muaj nuj nqi (xwm txheej) {event.preventDefault (); event.stopPropagation (); paub tab -= 1; $ (qhov no).parent.remove ();}); /* qhia tshem tag nrho khawm thaum peb muaj ntau dua 3 cov haujlwm */ yog tias (cov haujlwm> 2) {$ ("#remveAll"). qhia ();}/ *tshem tawm txhua tus tswj hwm */ $ ("#tshem tawm tag nrho"). ntawm ("nyem", xwm txheej => {event.preventDefault (); event.stopPropagation (); $ (". xiam oob qhab"). kwvtij (). tshem (); haujlwm = 0; $ ("#tshem tawm tag nrho"). nkaum ();});}});});

    Nco tseg: Koj tuaj yeem tau txais clone lossis rub tawm ZIP ntawm tus lej los ntawm kuv GitHub chaw cia khoom, qhov no zoo cawm koj los ntawm tapping.

    git clone github.com/ahmnouira/simple-todolist

    STEP4: sim cov cai

    Qhib koj tus browser thiab nkag mus rau ib txoj haujlwm ces nyem Ntxiv, koj yuav pom cov haujlwm tshiab tau ntxiv rau hauv cov npe, yog tias koj ntxiv 3 txoj haujlwm koj yuav pom tias lub pob clearAll tau tshwm sim, lub pob no tso cai rau peb tshem tag nrho cov haujlwm ntxiv, koj tseem tuaj yeem tshem tawm tsuas yog ib txoj haujlwm yuav nyem rau ntawm nws lub pob.

    Kauj Ruam 7: (Tsis teb los tau) Tso lub App

    Txog tam sim no peb tau tsim cov npe yooj yim todo app, tam sim no nws yog lub sijhawm los nthuav tawm nws hauv huab thiab qhia peb cov haujlwm nrog lwm tus thoob ntiaj teb.

    Txhawm rau ua tiav qhov no peb yuav siv huab platform hu ua ZEIT Tam sim no.

    ZEIT Tam sim no yog dab tsi?

    ZEIt Tam sim no yog huab huab rau qhov chaw zoo li qub thiab Tsis muaj Server Tsis Ua Haujlwm, nws ua rau cov neeg tsim khoom tuaj yeem tuav cov vev xaib thiab cov kev pabcuam web uas nthuav tawm tam sim, txhua yam no nrog xoom teeb tsa.

    1. Nruab Tam Sim No CLI

    Txhawm rau xa nrog ZEIT Tam sim no, koj yuav tsum tau teeb tsa Tam sim no CLI.

    tseem ceeb: Nco ntsoov tias koj tau nruab npm.

    npm -v # kos yog tias npm nruab

    npm nruab -g tam sim no@kawg # nruab qhov kawg ntawm Tam sim no CLI thoob ntiaj teb tam sim no -v # chech yog Tam sim no CLI tau teeb tsa thiab luam nws version

    2. Tso tawm

    Txhua yam koj yuav tsum ua yog txav mus rau hauv phau ntawv teev npe thiab tom qab ntawd xa koj li app nrog ib qho lus txib nkaus xwb:

    tam sim no --prod # xa daim ntawv thov

    Thaum xa tawm, koj yuav tau txais qhov URL saib ua ntej uas tau muab rau ntawm txhua qhov kev xa tawm los qhia qhov kev hloov pauv tshiab tshaj plaws hauv qab qhov chaw nyob.

    kuv app:

    Kauj Ruam 8: Xaus

    Qhov ntawd tsuas yog muaj rau nws!

    Xav tias dawb los tshawb nrhiav cov cai los ntawm teeb tsa cov yam ntxwv tshiab thiab nthuav lub app, thiab qhia koj cov kev paub thiab cov lus nug hauv cheeb tsam tawm tswv yim.

    Txhawm rau pom ntau yam kuv ua haujlwm thov mus saib kuv qhov qhib ntawm GitHub.

    kuv tus YouTube.

    myLinkedIn

    Ua tsaug rau lub sijhawm los nyeem kuv cov lus qhia ^^.

    Muaj ib hnub zoo.

    Ahmed Nouira: koj puas xav tau ntau tus thwjtim?

Pom zoo: