samedi 1 octobre 2016

Cannot setup and run vuejs in laravel

I am quite new to vue.js but familiar with laravel. Now with laravel 5.3 release, am trying to run some sample application using vue.

resources/js/app.js :

    /**
     * First we will load all of this project's JavaScript dependencies which
     * include Vue and Vue Resource. This gives a great starting point for
     * building robust, powerful web applications using Vue and Laravel.
     */

    require('./bootstrap');

    /**
     * Next, we will create a fresh Vue application instance and attach it to
     * the body of the page. From here, you may begin adding components to
     * the application, or feel free to tweak this setup for your needs.
     */



    new Vue({
          el: 'body',
          data: {
          message: 'Hello Vue World!'
          }
        })

welcome.blade.php

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src=""></script>
<link rel="stylesheet" href="">
<title>Laravel</title>

<!-- Fonts -->
<link href="http://ift.tt/2dHeAcp"
    rel="stylesheet" type="text/css">


</head>
<body>
    <div id="app">@</div>
</body>
</html>

gulpfile.js

const elixir = require('laravel-elixir');

require('laravel-elixir-vue');

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(function(mix) {
    mix.sass('app.scss');
});

elixir(function(mix) {
    mix.browserify('app.js');
});

elixir(function(mix) {
    mix.version(['css/app.css', 'js/app.js']);
});

am getting an error saying [Vue warn]: Cannot find element: body

any help is appreciated,

Followed some tutorial here : http://ift.tt/2dhszak



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2dHdeOt
via IFTTT

Aucun commentaire:

Enregistrer un commentaire