0

Hi i try to make show some data but i make something wrong if i put all stuff on same file for example overview.js den it will be ok. the result should be 3 boxes with some data.

this is my blade.php :

@extends('index')
@section('container')
    <template>
    <div class="row" id="app">
        <div class="col-lg-3 col-sm-6" v-for="stats in statsCards">
            <stats-card>
                <div class="icon-big text-center" :class="`icon-${stats.type}`" slot="header">
                    <i :class="stats.icon"></i>
                </div>
                <div class="numbers" slot="content">
                    <p>{{stats.title}}</p>
                    {{stats.value}}
                </div>
                <div class="stats" slot="footer">
                    <i :class="stats.footerIcon"></i> {{stats.footerText}}
                </div>
            </stats-card>
        </div>
    </div>
        </template>
    <script src="resources/assets/js/app.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.18/vue.min.js"></script>
@endsection 

and this is my vue.js file app.js

import StatsCard from 'js/components/UIComponents/Cards/StatsCard.vue'
new Vue({

    el: '#app',

    export default {
        components: {
            StatsCard

        },

    data() return {

        statsCards: [
            {
                type: 'warning',
                icon: 'ti-server',
                title: 'Capacity',
                value: '105GB',
                footerText: 'Updated now',
                footerIcon: 'ti-reload'
            },
            {
                type: 'success',
                icon: 'ti-wallet',
                title: 'Revenue',
                value: '$1,345',
                footerText: 'Last day',
                footerIcon: 'ti-calendar'
            },
            {
                type: 'danger',
                icon: 'ti-pulse',
                title: 'Errors',
                value: '23',
                footerText: 'In the last hour',
                footerIcon: 'ti-timer'
            },
            {
                type: 'info',
                icon: 'ti-twitter-alt',
                title: 'Followers',
                value: '+45',
                footerText: 'Updated now',
                footerIcon: 'ti-reload'
            }
        ]

    }
}

})

I recieve this error Use of undefined constant stats - assumed 'stats' i don't know what i make wrong any idea ? thanks for your Help.

1 Answer 1

1

Blade tries to executes the contents of {{ }} as php. You need to escape it: @{{ }}.

Sign up to request clarification or add additional context in comments.

1 Comment

You escaped all them? Also, you are pulling in an old version of Vue.

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.