0

I'm stucked with this code. I can't make it work, and i don't get any errors. Which might mean that i need an aditional dependency? It's simply not showing. Please help me. Thanks.

app.js - file

Vue.component('message', require('./components/Message.vue'));

const app = new Vue({
    el: '#app'
});

Message.vue - file

<template>
    <div class="container">
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">Message</div>
                    <div class="panel-body">
                        I'm the component!
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        ready () {
            console.log('Component ready')
        }
    }
</script>

home.blade.php - file

@extends('templates.default')

@section('content')
    <h3>Welcome to Site</h3>
    <div class="container">
        <div id="app">
            <message></message>
        </div>
    </div>
@stop
3
  • Do you have vue dev tools? You can check to see if the root instance has been created. Also if you are using vue 2 theready method has depreciated, you should use mounted or other lifecycle methods. Commented Feb 23, 2017 at 7:54
  • How will i update vue js to 2 with composer? Commented Feb 23, 2017 at 7:59
  • I have Vue 2.1.0, but still nto showing anything. Please help. Commented Feb 23, 2017 at 10:34

2 Answers 2

1

You may also need to clear browser cache when working with frontend. On mac this is command + shift + R. Also make sure you did run gulp to compile your js file.

Also make sure you included compiled js file to your layout template before </body>:

<script src="/js/app.js"></script>
Sign up to request clarification or add additional context in comments.

Comments

0

I think you're missing the .default from the line

Vue.component('message', require('./components/Message.vue').default);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.