简体   繁体   中英

Laravel blade-template import vuejs-datepicker not working

I'm trying to import the vuejs-datepicker in my template, but it is not working. I don't see any result and if I look in the console it says: Uncaught SyntaxError: Unexpected identifier. Am I doing something wrong? Is it that a import is not possible in a blade-template?

registration.blade.php:

@section('content')
...
<div class="col-lg-3 col-md-6">
                        <div class="form-group">
                            <label for="yearOfBirth">YEAR OF BIRTH*</label>

                            <datepicker></datepicker>
                        </div>
                    </div>
...
@endsection('content')

@endsection('content')

@section('scripts')
<script>
import Datepicker from 'vuejs-datepicker';

new Vue({
    el: '#form',
    data: {
        name: 'Your horse',
        items: []
    },
    methods: {
        addVideo(){
            this.items.push({
                value: ''
            });
        },
        deleteVideo(index){
            this.items.splice(index,1);
        }
    },
    components: {
        Datepicker: Datepicker
    }
});
</script>
@endsection

Found the solutions. It was in Webpack where all the scripts where in mix.scripts, while this JS-file needs to be in mix.js.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM