{"id":4146,"date":"2019-07-18T20:14:07","date_gmt":"2019-07-18T11:14:07","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=4146"},"modified":"2019-07-18T22:14:21","modified_gmt":"2019-07-18T13:14:21","slug":"laravel-vue%e3%81%a7%e3%83%8d%e3%83%83%e3%83%88%e3%82%ab%e3%83%95%e3%82%a7%e3%81%ae%e3%80%8c%e6%a3%9a%e3%81%ae%e5%a0%b4%e6%89%80%e3%82%b7%e3%82%b9%e3%83%86%e3%83%a0%e3%80%8d%e3%82%92%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=4146","title":{"rendered":"Laravel + Vue\u3067\u30cd\u30c3\u30c8\u30ab\u30d5\u30a7\u306e\u300c\u68da\u306e\u5834\u6240\u30b7\u30b9\u30c6\u30e0\u300d\u3092\u4f5c\u3063\u3066\u307f\u308b\uff08\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u53ef\uff09"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u306f<a href=\"https:\/\/blog.capilano-fw.com\/?p=4137\">Vue.js\u3067\u30da\u30fc\u30b8\u96e2\u8131\u3092\u963b\u6b62\u3059\u308b<\/a>\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u307e\u3057\u305f\u304c\u3001\u3084\u3063\u3071\u308a<code>Vue<\/code>\u306f\u4f7f\u3044\u3084\u3059\u304f\u3066\u3044\u3044\u3067\u3059\u306d\u3002\u5b66\u7fd2\u30b3\u30b9\u30c8\u304c\u5c11\u306a\u3044\u306e\u3067\u65b0\u3057\u304f\u59cb\u3081\u308b\u306e\u3082\u7c21\u5358\u3067\u3059\u3057\u3001\u306a\u306b\u3088\u308a\u74b0\u5883\u3092\u6574\u3048\u306a\u304f\u3066\u3082\u3059\u3050\u4f7f\u3048\u308b\u306e\u304c\u5b09\u3057\u3044\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u6d41\u308c\u3067\u4eca\u56de\u3082<code>Vue<\/code>\u306e\u8a71\u984c\u3092\u304a\u5c4a\u3051\u3057\u3088\u3046\u3068\u8003\u3048\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u3075\u3068\u3053\u306e\u9593\u884c\u3063\u305f\u30cd\u30c3\u30c8\u30ab\u30d5\u30a7\u306b\u3044\u3063\u305f\u6642\u306e\u3053\u3068\u3092\u601d\u3044\u51fa\u3057\u307e\u3057\u305f\u3002\u305d\u306e\u6642\u30d6\u30fc\u30b9\u306b\u3042\u308b\u30d1\u30bd\u30b3\u30f3\u3067\u6f2b\u753b\u3092\u691c\u7d22\u3057\u305f\u306e\u3067\u3059\u304c\u3001<strong>\u300c\u305d\u306e\u6f2b\u753b\u304c\u3069\u3053\u306b\u3042\u308b\u304b\u300d<\/strong>\u3082\u5e97\u5185\u30de\u30c3\u30d7\u3067\u8868\u793a\u3057\u3066\u304f\u308c\u3066\u3044\u305f\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u3063\u3066\u3059\u3054\u304f\u4fbf\u5229\u3067\u3059\u3088\u306d\ud83d\ude0a\u2728<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u30b7\u30b9\u30c6\u30e0\u3092\u79c1\u306a\u308a\u306b\u4f5c\u3063\u3066\u307f\u305f\u304f\u306a\u3063\u305f\u306e\u3067\u3001\u4eca\u56de\u306f<code>&lt;canvas&gt;<\/code>\u30bf\u30b0\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\uff08\u306a\u304a\u3001\u5b9f\u969b\u306e\u691c\u7d22\u30b7\u30b9\u30c6\u30e0\u306fCSS\u3067\u77e2\u5370\u3092\u7d76\u5bfe\u4f4d\u7f6e\u306b\u6307\u5b9a\u3057\u3066\u3044\u308b\u65b9\u6cd5\u3067\u3057\u305f\uff09<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3566 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png\" alt=\"\" width=\"306\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png 306w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1-287x300.png 287w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/><\/p>\n<p>\u958b\u767a\u74b0\u5883\uff1a Laravel 5.8, Vue 2.6<\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u4eca\u56de\u306f\u3001\u5927\u304d\u304f\u5206\u3051\u3066\u4ee5\u4e0b\uff12\u3064\u306e\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u5e97\u5185\u30de\u30c3\u30d7\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u305d\u3053\u306b\u8d64\u4e38\u3092\u8868\u793a\u3057\u3001\u3055\u3089\u306b\u6f2b\u753b\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u5165\u529b\u3057\u3066\u9001\u4fe1\u3059\u308b\u3068\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u305d\u306e\u60c5\u5831\u304c\u4fdd\u5b58\u3055\u308c\u308b<\/li>\n<li>\u3059\u3067\u306b\u4fdd\u5b58\u3055\u308c\u305f\u6f2b\u753b\u306e\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3057\u3001\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u305d\u308c\u304c\u3069\u3053\u306e\u68da\u306b\u3042\u308b\u304b\u3092\u30aa\u30ec\u30f3\u30b8\u306e\u4e38\u3067\u8868\u793a\u3059\u308b<\/li>\n<\/ul>\n<p>\u3064\u307e\u308a\u3001\u3053\u3093\u306a\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u2193\u2193\u2193<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4150\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_2.png\" alt=\"\" width=\"640\" height=\"514\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_2.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_2-300x241.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u203b \u672c\u7269\u306e\u6f2b\u753b\u30bf\u30a4\u30c8\u30eb\u3092\u52dd\u624b\u306b\u4f7f\u3046\u3068\u554f\u984c\u3042\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u306e\u3067\u3001\u4eca\u56de\u306f\u30d1\u30ed\u30c7\u30a3\u3063\u307d\u304f\u5909\u66f4\u3057\u3066\u3044\u307e\u3059\ud83d\ude02<\/p>\n<p>\u3067\u306f\u3001\u3072\u3068\u3064\u305a\u3064\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\uff01<\/p>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u4eca\u56de\u5fc5\u8981\u306b\u306a\u308b\u306e\u306f\u3001\u4ee5\u4e0b\uff13\u3064\u306eURL\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u5e97\u5185\u30de\u30c3\u30d7\u3092\u8868\u793a\u3059\u308bURL<\/li>\n<li>Ajax\u3067\u767b\u9332\u6e08\u307f\u306e\u6f2b\u753b\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308bURL<\/li>\n<li>Ajax\u3067\u6f2b\u753b\u30c7\u30fc\u30bf\u3092\u65b0\u898f\u4fdd\u5b58\u3059\u308bURL<\/li>\n<\/ol>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067<code>routes\/web.php<\/code>\u306b\u6b21\u306e\u30eb\u30fc\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>Route::get('internet_cafe\/index', 'InternetCafeController@index');<\/strong>\n<strong>Route::get('internet_cafe\/create', 'InternetCafeController@create');<\/strong>\n<strong>Route::post('internet_cafe\/store', 'InternetCafeController@store');<\/strong><\/pre>\n<h1>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u3001\u307e\u3060\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>php artisan make:controller InternetCafeController<\/strong><\/pre>\n<p><code>app\/Http\/Controllers\/InternetCafeController.php<\/code>\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u958b\u3044\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002\uff08\u592a\u5b57\u304c\u5909\u66f4\u3057\u305f\u90e8\u5206\u3067\u3059\uff09<\/p>\n<pre>&lt;?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\n\nclass InternetCafeController extends Controller\n{\n    <strong>public function index() {<\/strong>\n\n<strong>        return \\App\\Book::all();<\/strong>\n\n<strong>    }<\/strong>\n\n<strong>    public function create() {<\/strong>\n\n<strong>        return view('internet_cafe_create');<\/strong>\n\n<strong>    }<\/strong>\n\n<strong>    public function store(Request $request) {<\/strong>\n\n<strong>        $book = new \\App\\Book();<\/strong>\n<strong>        $book-&gt;title = $request-&gt;title;<\/strong>\n<strong>        $book-&gt;position_x = $request-&gt;position['x'];<\/strong>\n<strong>        $book-&gt;position_y = $request-&gt;position['y'];<\/strong>\n<strong>        $book-&gt;save();<\/strong>\n\n<strong>    }<\/strong>\n}<\/pre>\n<p>\u3061\u306a\u307f\u306b\u3001\u5404\u30e1\u30bd\u30c3\u30c9\u306e\u5185\u5bb9\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ul>\n<li>index()\u3000\u30fb\u30fb\u30fb\u3000Ajax\u3067\u4fdd\u5b58\u6e08\u307f\u306e\u6f2b\u753b\u30c7\u30fc\u30bf\u5168\u3066\u3092\u8fd4\u3057\u307e\u3059<\/li>\n<li>create()\u3000\u30fb\u30fb\u30fb\u3000\u5e97\u5185\u30de\u30c3\u30d7\u3092\u8868\u793a\u3057\u3001\u8ffd\u52a0\uff06\u8868\u793a\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u4eca\u56de\u30d6\u30e9\u30a6\u30b6\u3067\u8868\u793a\u3055\u308c\u308b\u306e\u306f\u3053\u3053\u3060\u3051\u3067\u3059\u3002<\/li>\n<li>store()\u3000\u30fb\u30fb\u30fb\u3000\u5f8c\u304b\u3089\u4f5c\u308bAjax\u9001\u4fe1\u304b\u3089\u300c\u672c\u306e\u30bf\u30a4\u30c8\u30eb\u300d\u3068\u300c\u672c\u306e\u4f4d\u7f6e\uff08x, y\uff09\u300d\u3092\u53d7\u53d6\u308a\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<h1>\u30e2\u30c7\u30eb\u3001DB\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u6f2b\u753b\u306e\u30c7\u30fc\u30bf\u3092\u7ba1\u7406\u3059\u308b\u30e2\u30c7\u30eb\u3068DB\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30e2\u30c7\u30eb + \u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4e00\u6c17\u306b\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>php artisan make:model Book -m<\/strong><\/pre>\n<p>\u305d\u3057\u3066\u3001\u4f5c\u6210\u3055\u308c\u305f\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3<code>\/database\/migrations\/****_**_**_******_create_books_table.php<\/code>\u3092\u958b\u3044\u3066\u6b21\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\n\nuse Illuminate\\Support\\Facades\\Schema;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Database\\Migrations\\Migration;\n\nclass CreateBooksTable extends Migration\n{\n    <strong>public function up()<\/strong>\n<strong>    {<\/strong>\n<strong>        Schema::create('books', function (Blueprint $table) {<\/strong>\n<strong>            $table-&gt;bigIncrements('id');<\/strong>\n<strong>            $table-&gt;string('title');<\/strong>\n<strong>            $table-&gt;float('position_x', 8, 3);<\/strong>\n<strong>            $table-&gt;float('position_y', 8, 3);<\/strong>\n<strong>            $table-&gt;timestamps();<\/strong>\n<strong>        });<\/strong>\n<strong>    }<\/strong>\n\n<strong>    public function down()<\/strong>\n<strong>    {<\/strong>\n<strong>        Schema::dropIfExists('books');<\/strong>\n<strong>    }<\/strong>\n}<\/pre>\n<p>\u5909\u66f4\u3057\u305f\u3089\u5fd8\u308c\u305a\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan migrate<\/strong><\/pre>\n<p>\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4147\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_1.png\" alt=\"\" width=\"346\" height=\"274\" \/><\/p>\n<h1>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u6700\u5f8c\u306b\u30d3\u30e5\u30fc\u3067\u3059\u3002<code>\/resources\/views\/internet_cafe_create.blade.php<\/code>\u3067\u4fdd\u5b58\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>&lt;html&gt;\n&lt;head&gt;\n    &lt;link href=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.3.1\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;div id=\"app\"&gt;\n    <strong>&lt;canvas id=\"canvas\" @click=\"openModal\"&gt;&lt;\/canvas&gt;<\/strong>\n    &lt;br&gt;\n    &lt;ul&gt;\n        <strong>&lt;li v-for=\"book in books\"&gt;<\/strong>\n<strong>            &lt;a href=\"#\" v-text=\"book.title\" @click.prevent=\"showBookPosition(book)\"&gt;&lt;\/a&gt;<\/strong>\n<strong>        &lt;\/li&gt;<\/strong>\n    &lt;\/ul&gt;\n    &lt;!-- \u30e2\u30fc\u30c0\u30eb --&gt;\n    <strong>&lt;div class=\"modal fade\" id=\"modal\"&gt;<\/strong>\n<strong>        &lt;div class=\"modal-dialog\" role=\"document\"&gt;<\/strong>\n<strong>            &lt;div class=\"modal-content\"&gt;<\/strong>\n<strong>                &lt;div class=\"modal-header\"&gt;<\/strong>\n<strong>                    &lt;h5 class=\"modal-title\"&gt;\u672c\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044&lt;\/h5&gt;<\/strong>\n<strong>                    &lt;button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"&gt;<\/strong>\n<strong>                        &lt;span aria-hidden=\"true\"&gt;&amp;times;&lt;\/span&gt;<\/strong>\n<strong>                    &lt;\/button&gt;<\/strong>\n<strong>                &lt;\/div&gt;<\/strong>\n<strong>                &lt;div class=\"modal-body\"&gt;<\/strong>\n<strong>                    &lt;input type=\"text\" class=\"form-control\" v-model=\"bookTitle\" autofocus&gt;<\/strong>\n<strong>                &lt;\/div&gt;<\/strong>\n<strong>                &lt;div class=\"modal-footer\"&gt;<\/strong>\n<strong>                    &lt;button type=\"button\" class=\"btn btn-light\" data-dismiss=\"modal\"&gt;\u30ad\u30e3\u30f3\u30bb\u30eb&lt;\/button&gt;<\/strong>\n<strong>                    &lt;button type=\"button\" class=\"btn btn-primary\" data-dismiss=\"modal\" @click=\"save\"&gt;\u4fdd\u5b58\u3059\u308b&lt;\/button&gt;<\/strong>\n<strong>                &lt;\/div&gt;<\/strong>\n<strong>            &lt;\/div&gt;<\/strong>\n<strong>        &lt;\/div&gt;<\/strong>\n<strong>    &lt;\/div&gt;<\/strong>\n&lt;\/div&gt;\n&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue@2.6.10\/dist\/vue.min.js\"&gt;&lt;\/script&gt;\n&lt;script src=\"https:\/\/code.jquery.com\/jquery-3.4.1.min.js\"&gt;&lt;\/script&gt;\n&lt;script src=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.3.1\/js\/bootstrap.min.js\"&gt;&lt;\/script&gt;\n&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/axios\/0.19.0\/axios.min.js\"&gt;&lt;\/script&gt;\n&lt;script&gt;\n\n    new Vue({\n        el: '#app',\n        data: {\n            canvas: null,\n            ctx: null,\n            books: [],\n            position: {\n                x: 0,\n                y: 0\n            },\n            bookTitle: ''\n        },\n        methods: {\n            <strong>openModal(e) {\n\n                this.clearCanvas(() =&gt; {\n\n                    const x = Math.round(e.offsetX \/ this.canvas.width * 1000) * 0.001;\n                    const y = Math.round(e.offsetY \/ this.canvas.height * 1000) * 0.001;\n                    this.position = {\n                        x: x,\n                        y: y\n                    };\n                    this.drawPoint('red');\n                    this.bookTitle = '';\n                    $('#modal').modal('show');\n\n                });\n\n            }<\/strong>,\n            save() {\n\n                const params = {\n                    title: this.bookTitle,\n                    position: this.position\n                };\n\n                axios.post('\/internet_cafe\/store', params)\n                    .then((response) =&gt; {\n\n                        this.getBooks();\n\n                    });\n\n                $('#modal').modal('hide');\n\n            },\n            getBooks() {\n\n                axios.get('\/internet_cafe\/index')\n                    .then((response) =&gt; {\n\n                        this.books = response.data;\n\n                    });\n\n            },\n            showBookPosition(book) {\n\n                this.position = {\n                    x: parseFloat(book.position_x),\n                    y: parseFloat(book.position_y)\n                };\n\n                this.clearCanvas(() =&gt; {\n\n                    this.drawPoint('orange');\n\n                });\n\n            },\n            drawPoint(color) {\n\n                const r = parseInt(canvas.height \/ 50);\n                const x = Math.round(this.position.x * canvas.width);\n                const y = Math.round(this.position.y * canvas.height);\n                this.ctx.beginPath();\n                this.ctx.arc(x, y, r, 0, 2 * Math.PI);\n                this.ctx.fillStyle = color;\n                this.ctx.fill();\n\n            },\n            clearCanvas(callback) {\n\n                this.ctx.clearRect(0, 0, canvas.width, canvas.height);\n                let img = new Image();\n                img.src = '\/images\/room_layout.png';\n                img.onload = () =&gt; {\n\n                    canvas.width = img.width;\n                    canvas.height = img.height;\n                    this.ctx.drawImage(img, 0, 0);\n\n                    if(typeof callback === 'function') {\n\n                        callback();\n\n                    }\n\n                };\n\n            }\n        },\n        <strong>mounted() {<\/strong>\n\n<strong>            this.canvas = document.getElementById('canvas');<\/strong>\n<strong>            this.ctx = canvas.getContext('2d');<\/strong>\n<strong>            this.clearCanvas();<\/strong>\n<strong>            this.getBooks();<\/strong>\n\n<strong>            $('#modal').on('hide.bs.modal', () =&gt; {<\/strong>\n\n<strong>                this.clearCanvas(() =&gt; {<\/strong>\n\n<strong>                    this.getBooks();<\/strong>\n\n<strong>                });<\/strong>\n\n<strong>            });<\/strong>\n\n<strong>        }<\/strong>\n\n    });\n\n&lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n<p>\u91cd\u8981\u306a\u30e1\u30bd\u30c3\u30c9\u304c\u6b21\u306e\uff13\u3064\u3067\u3059\u3002<\/p>\n<ul>\n<li>clearCanvas()\u3000\u30fb\u30fb\u30fb\u3000\u30ad\u30e3\u30f3\u30d0\u30b9\u3092\u30af\u30ea\u30a2\u3057\u3066\u80cc\u666f\u306b\u306a\u308b\u5e97\u5185\u30de\u30c3\u30d7\u3092\u63cf\u753b\u3057\u3057\u307e\u3059\u3002\u3061\u306a\u307f\u306b\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3092\u6709\u52b9\u306b\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u306f\u753b\u50cf\u304c\u63cf\u753b\u3055\u308c\u308b\u307e\u3067\u30bf\u30a4\u30e0\u30e9\u30b0\u306b\u3088\u3063\u3066\u306f\u63cf\u753b\u3057\u305f\u306f\u305a\u306e\u4e38\u5370\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u3053\u3068\u3092\u4e88\u9632\u3059\u308b\u610f\u5473\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<li>drawPoint()\u3000\u30fb\u30fb\u30fb\u3000\u4e38\u5370\u3092\u30ad\u30e3\u30f3\u30d0\u30b9\u306b\u63cf\u753b\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002\u306a\u304a\u3001\u4e38\u5370\u306e\u4f4d\u7f6e\u306f\u30d4\u30af\u30bb\u30eb\u3067\u306f\u306a\u304f\u5272\u5408\uff080.000 ~ 1.000\uff09\u3067\u7ba1\u7406\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u5c06\u6765\u7684\u306b\u5e97\u5185\u30de\u30c3\u30d7\u306e\u30b5\u30a4\u30ba\u304c\u5909\u308f\u3063\u3066\u3082\u554f\u984c\u306a\u304f\u5bfe\u5fdc\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u51e6\u7f6e\u3067\u3059\u3002\u307e\u305f\u3001\u4e38\u5370\u306e\u5927\u304d\u3055\u306f\u9ad8\u3055\u306e50\u5206\u306e1\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n<li>openModal()\u3000\u30fb\u30fb\u30fb\u3000\u5e97\u5185\u30de\u30c3\u30d7\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3068\u304d\u306b\u5b9f\u884c\u3055\u308c\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3001\u30af\u30ea\u30c3\u30af\u30a4\u30d9\u30f3\u30c8\u304b\u3089\u4f4d\u7f6e\u60c5\u5831\u3092\u53d6\u5f97\u3001\u5272\u5408\u3092\u8a08\u7b97\u3057\u3001\u5c11\u6570\u7b2c\uff13\u4f4d\u3067\u56db\u6368\u4e94\u5165\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u3042\u3068\u306f\u3001<code>Ajax<\/code>\u3068\u3057\u3066<code>axios<\/code>\u3001\u30e2\u30fc\u30c0\u30eb\u304c<code>bootstrap<\/code>\u3001\u30ea\u30b9\u30c8\u8868\u793a\u306f<code>Vue<\/code>\u306e<code>v-for<\/code>\u3068\u3001\u305d\u308c\u307b\u3069\u8907\u96d1\u306a\u3082\u306e\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\uff01<\/p>\n<p>\u307e\u305a\u30da\u30fc\u30b8\u3092\u958b\u304f\u3068\u5e97\u5185\u30de\u30c3\u30d7\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4152\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/room_layout.png\" alt=\"\" width=\"640\" height=\"400\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/room_layout.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/room_layout-300x188.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u6b21\u306b\u767b\u9332\u3057\u305f\u3044\u6f2b\u753b\u306e\u5834\u6240\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u305d\u306e\u5834\u6240\u306b\u8d64\u4e38\u304c\u8868\u793a\u3055\u308c\u30e2\u30fc\u30c0\u30eb\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u6f2b\u753b\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u5165\u529b\u3057\u3066<strong>\u300c\u4fdd\u5b58\u3059\u308b\u300d<\/strong>\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4153\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_3.png\" alt=\"\" width=\"828\" height=\"253\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_3.png 828w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_3-300x92.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_3-768x235.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u6f2b\u753b\u306e\u60c5\u5831\u304c\u4fdd\u5b58\u3055\u308c\u308b\u306e\u3067\u3001\u30ea\u30b9\u30c8\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4154\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_4.png\" alt=\"\" width=\"640\" height=\"437\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_4.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_4-300x205.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u3067\u306f\u3001\u30bf\u30a4\u30c8\u30eb\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4155\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_5.png\" alt=\"\" width=\"639\" height=\"440\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_5.png 639w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/07\/internet_cafe_5-300x207.png 300w\" sizes=\"auto, (max-width: 639px) 100vw, 639px\" \/><\/p>\n<p>\u306f\u3044\uff01\u767b\u9332\u3057\u305f\u3068\u304d\u306b\u30af\u30ea\u30c3\u30af\u3057\u305f\u5834\u6240\u306b\u30aa\u30ec\u30f3\u30b8\u306e\u4e38\u5370\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002\u6210\u529f\u3067\u3059\u306d\ud83d\ude0a\u2728<\/p>\n<p>\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\uff01<\/p>\n<h1>\u304a\u307e\u3051\uff1a\u5341\u5b57\u30ad\u30fc\u3067\u8d64\u4e38\u3092\u79fb\u52d5\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h1>\n<p>\u3061\u306a\u307f\u306b\u3053\u306e\u307e\u307e\u3060\u3068\u3001\u30af\u30ea\u30c3\u30af\u3057\u305f\u4f4d\u7f6e\u304c\u305a\u308c\u3066\u3057\u307e\u3063\u305f\u5834\u5408\u3001\u3044\u3061\u3044\u3061\u30ad\u30e3\u30f3\u30bb\u30eb\u3057\u3066\u518d\u5ea6\u30af\u30ea\u30c3\u30af\u3057\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u308c\u3067\u306f\u4f5c\u696d\u304c\u3081\u3093\u3069\u3046\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u306e\u3067\u3001\u304a\u307e\u3051\u3068\u3057\u3066\u767b\u9332\u6642\u306e\u8d64\u4e38\u304c\u4e0a\u4e0b\u5de6\u53f3\u30ad\u30fc\u3067\u79fb\u52d5\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\uff08\u30e2\u30fc\u30c0\u30eb\u306b\u96a0\u308c\u3066\u898b\u3048\u306a\u3044\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u306e\u6a5f\u80fd\u306f\u5f8c\u4ed8\u3051\u306e\u300c\u304a\u307e\u3051\u300d\u306a\u306e\u3067\u3001\u305d\u3053\u306f\u3054\u5bb9\u8d66\u304f\u3060\u3055\u3044\ud83d\ude05\uff09<\/p>\n<pre>mounted() {\n\n    \/\/ \u7701\u7565\n\n    \/\/ \u304a\u307e\u3051\n    <strong>document.onkeydown = (e) =&gt; {<\/strong>\n\n<strong>        const key = e.key;<\/strong>\n<strong>        const keys = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];<\/strong>\n\n<strong>        if(keys.includes(key)) {<\/strong>\n\n<strong>            if(key === 'ArrowUp') {<\/strong>\n\n<strong>                this.position.y -= 0.001;<\/strong>\n\n<strong>            } else if(key === 'ArrowDown') {<\/strong>\n\n<strong>                this.position.y += 0.001;<\/strong>\n\n<strong>            } else if(key === 'ArrowLeft') {<\/strong>\n\n<strong>                this.position.x -= 0.001;<\/strong>\n\n<strong>            } else if(key === 'ArrowRight') {<\/strong>\n\n<strong>                this.position.x += 0.001;<\/strong>\n\n<strong>            }<\/strong>\n\n<strong>            this.clearCanvas(() =&gt; {<\/strong>\n\n<strong>                this.drawPoint('red');<\/strong>\n\n<strong>            });<\/strong>\n\n<strong>        }<\/strong>\n\n<strong>    };<\/strong>\n\n}<\/pre>\n<h1>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b<\/h1>\n<p>\u4eca\u56de\u5b9f\u969b\u306b\u958b\u767a\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e00\u5f0f\u3092\u4ee5\u4e0b\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u203b \u305f\u3060\u3057\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306a\u3069\u306f\u3054\u81ea\u8eab\u3067\u5b9f\u884c\u3057\u3066\u3044\u305f\u3060\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306a\u3069\u306f\u5b9f\u88c5\u3057\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"https:\/\/blog.capilano-fw.com?download=4156&amp;tmstv=1777537025\" rel=\"nofollow\" id=\"download-link-4156\" data-redirect=\"false\" >\n\tLaravel + Vue\u3067\u30cd\u30c3\u30c8\u30ab\u30d5\u30a7\u306e\u300c\u68da\u306e\u5834\u6240\u30b7\u30b9\u30c6\u30e0\u300d<\/a>\n\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u4eca\u56de\u306f\u30cd\u30c3\u30c8\u30ab\u30d5\u30a7\u306e\u3088\u3046\u306a\u4f4d\u7f6e\u7ba1\u7406\u306e\u6a5f\u80fd\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u304a\u3001<code>JavaScript<\/code>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306e\u4e2d\u306b\u3042\u308b<code>clearCanvas()<\/code>\u306f\u3001\u753b\u50cf\u306e\u30ed\u30fc\u30c9\u306b\u30bf\u30a4\u30e0\u30e9\u30b0\u304c\u3042\u308b\u3053\u3068\u304b\u3089\u5f53\u521d\u306f<code>Promise<\/code>\u3068<code>await<\/code>\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u305d\u3046\u306a\u308b\u3068<code>async<\/code>\u8868\u8a18\u3092\u4f7f\u308f\u306a\u3044\u3068\u3044\u3051\u306a\u304f\u306a\u3063\u3066\u8907\u96d1\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u7d39\u4ecb\u3068\u3057\u3066\u306f\u3042\u307e\u308a\u9069\u3055\u306a\u3044\u3068\u5224\u65ad\u3057\u305f\u306e\u3067\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3092\u4f7f\u3046\u5f62\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001\u3088\u308a\u65b0\u3057\u3044\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304d\u305f\u3044\u65b9\u306f<code>Promise<\/code>\u3092\u4f7f\u3063\u3066\u3044\u304f\u3068\u3044\u3044\u3067\u3057\u3087\u3046\u3002\uff08\u305f\u3060\u3057\u3001\u3044\u3064\u3082\u306e\u3054\u3068\u304f\u3067\u3059\u304c\u3001<code>IE<\/code>\u306f<code>Promise<\/code>\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u305b\u3093\u306e\u3067\u3054\u6ce8\u610f\u3092 &#8230; \ud83d\ude2b\uff09<\/p>\n<p>\u307e\u305f\u3001\u65b0\u3057\u3044<code>JavaScript<\/code>\u306e\u66f8\u304d\u65b9\u3068\u3044\u3048\u3070\u3001\u6700\u5f8c\u306b\u304a\u307e\u3051\u3068\u3057\u3066\u3064\u3051\u305f\u300c\u5341\u5b57\u30ad\u30fc\u3067\u8d64\u4e38\u3092\u79fb\u52d5\u3059\u308b\u300d\u90e8\u5206\u3067\u3059\u304c\u3001\u3053\u308c\u3082\u904e\u53bb\u306e<code>JavaScript<\/code>\u3067\u306f\u3088\u304f\u4f7f\u3063\u3066\u3044\u305f<code>e.keyCode<\/code>\u3092\u4f7f\u308f\u305a<code>e.key<\/code>\u3092\u4f7f\u3046\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u3059\u3067\u306b<code>keyCode<\/code>\u306f\u975e\u63a8\u5968\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u3093\u3067\u3059\u306d\u3002<code>ArrowUp<\/code>\u3068\u304b\u304c\u8fd4\u3063\u3066\u304f\u308b\u306e\u3067\u3053\u3063\u3061\u306e\u307b\u3046\u304c\u3088\u308a\u76f4\u611f\u7684\u304b\u3068\u601d\u3044\u307e\u3059\uff01<\/p>\n<p>\u4ee5\u4e0a\u3001\u30cd\u30c3\u30c8\u30ab\u30d5\u30a7\u306e\u4f4d\u7f6e\u7ba1\u7406\u6a5f\u80fd\u3067\u3057\u305f\u3002<br \/>\n\u305c\u3072\u7686\u3055\u3093\u3082\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2595 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/7.png\" alt=\"\" width=\"226\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/7.png 226w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/7-212x300.png 212w\" sizes=\"auto, (max-width: 226px) 100vw, 226px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u306fVue.js\u3067\u30da\u30fc\u30b8\u96e2\u8131\u3092\u963b\u6b62\u3059\u308b\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u307e\u3057\u305f\u304c\u3001\u3084\u3063\u3071\u308aVue\u306f\u4f7f\u3044\u3084\u3059\u304f\u3066\u3044\u3044\u3067\u3059\u306d\u3002\u5b66\u7fd2\u30b3\u30b9\u30c8\u304c\u5c11\u306a\u3044\u306e\u3067\u65b0\u3057\u304f\u59cb\u3081\u308b\u306e\u3082\u7c21\u5358 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=4146\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel + Vue\u3067\u30cd\u30c3\u30c8\u30ab\u30d5\u30a7\u306e\u300c\u68da\u306e\u5834\u6240\u30b7\u30b9\u30c6\u30e0\u300d\u3092\u4f5c\u3063\u3066\u307f\u308b\uff08\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u53ef\uff09&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":4160,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,3,12,97],"tags":[28],"class_list":["post-4146","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html5","category-laravel","category-vue-js","category-97","tag-canvas"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4146"}],"version-history":[{"count":5,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4146\/revisions"}],"predecessor-version":[{"id":4162,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4146\/revisions\/4162"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/4160"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}