Shigarwa da Tsara Nuxt.js Ayyuka
Shigar Node.js
Tabbatar cewa an shigar da Node.js akan kwamfutarka. Kuna iya saukar da sabon sigar daga gidan yanar gizon Node.js na hukuma.
Shigar da Vue CLI
Bude ku Terminal ko Command Prompt kuma gudanar da umarni mai zuwa don shigar da Vue CLI(idan ba a riga an shigar ba):
npm install -g vue-cli
Ƙirƙiri Nuxt.js Project
A cikin Terminal, kewaya zuwa kundin adireshi inda kake son ƙirƙirar aikin ku kuma gudanar da umarni mai zuwa don ƙirƙirar aikin Nuxt.js:
vue init nuxt-community/starter-template my-nuxt-project
Kanfigareshan Aikin
Bi tsokaci a cikin Terminal don saita aikin ku. Kuna iya zaɓar zaɓuɓɓuka daban-daban don aikinku, kamar amfani da ESLint, sakawa Axios, da sauransu.
Ƙirƙirar Shafi na Farko da Nuna Babban Abun ciki:
Bude Directory Project
Buɗe naka Terminal kuma kewaya zuwa kundin aikin ta amfani da umarni cd my-nuxt-project
(ko sunan babban fayil ɗin da kuka zaɓa).
Ƙirƙiri Sabon Shafi
Yi amfani da Vue CLI don ƙirƙirar sabon shafi tare da umarni mai zuwa:
npx vue-cli-service generate page mypage
Gyara Sabon Shafi
Bude mypage.vue
fayil ɗin a cikin pages
kundin adireshi kuma gyara abubuwan da ke cikin shafin. Kuna iya ƙara abubuwan HTML, Vue, da bayanai.
Nuna Shafin
A cikin layouts/default.vue
fayil ɗin, zaku iya amfani da <nuxt/>
alamar don nuna abubuwan da ke cikin shafin.
Gudanar da Aikin
A cikin Terminal, gudanar da umarni mai zuwa don fara aikin kuma duba shafinku a cikin burauza:
npm run dev
Yanzu kuna da shafinku na farko a cikin Nuxt.js aikin kuma kuna iya tsara abun ciki kamar yadda ake so.