Upgrade to Pro — share decks privately, control downloads, hide ads and more …

"Laravel/ui" 使い始め #larasap

"Laravel/ui" 使い始め #larasap

Laravel x Vue.js 勉強会 in ゆめみ札幌 vol.2 LT資料
https://larasap.connpass.com/event/148886/

Kihara, Takuya

October 31, 2019
Tweet

More Decks by Kihara, Takuya

Other Decks in Technology

Transcript

  1. !UBDDL -BSBWFMY7VFKTษڧձJOΏΊΈࡳຈWPMMBSBTBQ ୭ • ໊લ tacck / ໦ݪ ୎໵ •

    ॴଐ גࣜձࣾϊʔεσΟςʔϧ • ओ࠵ • ΏΔWebษڧձ@ࡳຈ • εϚʔτεϐʔΧʔͰ༡΅͏ձ@ࡳຈ • ޷͖ͳϑΟΪϡΞεέʔτͷٕ εϓϨουɾΠʔάϧ
  2. !UBDDL -BSBWFMY7VFKTษڧձJOΏΊΈࡳຈWPMMBSBTBQ $ composer create-project --prefer-dist laravel/laravel blog “6.0.*" $

    cd blog $ php artisan make:auth Command "make:auth" is not defined. Did you mean one of these? make:channel make:command make:controller make:event make:exception make:factory make:job make:listener
  3. !UBDDL -BSBWFMY7VFKTษڧձJOΏΊΈࡳຈWPMMBSBTBQ $ composer create-project --prefer-dist laravel/laravel blog "6.0.*" $

    cd blog $ composer require laravel/ui --dev $ php artisan ui vue --auth $ npm install $ php artisan serve Laravel development server started: http://127.0.0.1:8000 [։ൃ༻αʔόىಈ]
  4. !UBDDL -BSBWFMY7VFKTษڧձJOΏΊΈࡳຈWPMMBSBTBQ [ผλʔϛφϧ] [webpack.mix.js ʹ௥ه] ``` mix.browserSync({ proxy: 'http://localhost:8000' });

    ``` $ npm run dev [BrowserSyncؔ࿈ͷύοέʔδ௥Ճͷϝοηʔδ] $ npm run watch [ϒϥ΢βͰ http://localhost:3000/ Λ։͘]
  5. !UBDDL -BSBWFMY7VFKTษڧձJOΏΊΈࡳຈWPMMBSBTBQ View ϒϥ΢β Webαʔό Laravel Blade Vue.js HTML HTML

    app.js ม׵͞ΕͨϑΝΠϧ܈͕
 ϒϥ΢βͰදࣔ https://www.example.com/user/1 app.js Vue.js ͸ࣄલʹϏϧυ Blade෦෼͸HTML΁ม׵
  6. !UBDDL -BSBWFMY7VFKTษڧձJOΏΊΈࡳຈWPMMBSBTBQ View ϒϥ΢β Webαʔό Laravel Blade Vue.js HTML HTML

    app.js ม׵͞ΕͨϑΝΠϧ܈͕
 ϒϥ΢βͰදࣔ https://www.example.com/user/1 app.js Vue.js ͸ࣄલʹϏϧυ Blade෦෼͸HTML΁ม׵ αʔόͷ৘ใΛ࢖ͬͯ
 HTMLΛΛ࡞੒ɻ ͜͜Ͱ͸JS͸ಈ࡞͍ͯ͠ͳ͍ɻ
  7. !UBDDL -BSBWFMY7VFKTษڧձJOΏΊΈࡳຈWPMMBSBTBQ View ϒϥ΢β Webαʔό Laravel Blade Vue.js HTML HTML

    app.js ม׵͞ΕͨϑΝΠϧ܈͕
 ϒϥ΢βͰදࣔ https://www.example.com/user/1 app.js Vue.js ͸ࣄલʹϏϧυ Blade෦෼͸HTML΁ม׵ ͜͜ͰɺVue.jsͷίϯϙʔωϯτΛ
 ϒϥ΢β͕DOM΁൓өɻ
  8. !UBDDL -BSBWFMY7VFKTษڧձJOΏΊΈࡳຈWPMMBSBTBQ ը໘ཁૉ࡞੒λΠϛϯά͕ճ • Laravel ͕ Blade ͔Β HTML ࡞੒


    → ͜͜Ͱ൓ө͞ΕΔͷ͸ *.blade.php ϑΝΠϧ
 ɹVue.js ͷίϯϙʔωϯτʹ͸ʮଐੑʯͰͷҾ͖౉͠ͷΈɻ
 ɹͦΕҎ֎Ͱ͸ɺίϯϙʔωϯτͷதΛૢ࡞Ͱ͖ͳ͍ɻ • ϒϥ΢β ͕ Vue.js Λ DOM ΁൓ө
 → ͜͜Ͱ൓ө͞ΕΔͷ͸ app.js (*.vue) ϑΝΠϧ
 ɹଐੑͰड͚औͬͨ΋ͷҎ֎ɺ
 ɹઐ༻API͕ͳ͍ͱαʔό͔Β৘ใΛऔΕͳ͍ɻ
  9. !UBDDL -BSBWFMY7VFKTษڧձJOΏΊΈࡳຈWPMMBSBTBQ xxxxxx xxxxxx xxxxxx xxxxxx _ _ __ xxxxxx

    xxxxxx xxxxxx αΠυͷϝχϡʔ͝ͱʹ Blade Ͱ࡞੒ɻ
 (ϖʔδભҠΞΫγϣϯ༗Γ) ϖʔδ಺ͷσʔλ͸αʔόͰऔಘ͠ɺ
 Vue.js ͷίϯϙʔωϯτʹଐੑͰҾ͖౉͠ɻ
  10. !UBDDL -BSBWFMY7VFKTษڧձJOΏΊΈࡳຈWPMMBSBTBQ xxxxxx xxxxxx xxxxxx xxxxxx _ _ __ xxxxxx

    xxxxxx xxxxxx ϖʔδ಺ͷίϯϙʔωϯτΛ Vue.js Ͱ࡞੒ɻ
 λϒ੾Γସ͑ͰͷϖʔδભҠແ͠ɻ ௥Ճ৘ใ͕ແ͚Ε͹ɺ௨৴΋ෆཁɻ