2
votes

I currently have a Laravel route leading to the index function of my controller with a passed ID, where I return the id in a view

public function index($id)
{
    return view('progress')
        ->with('identifier', $id);
}

In the component loaded in said view I'm trying to access the identifier as a prop in my vue script

props: ['identifier'],
    methods: {
        getInformation() {
            this.$root.$emit('fetchEvent');
        },
    },
    mounted () {
        console.dir(this.identifier);
    }

However, my console says undefined and I can't figure out how to get the passed identifier as a prop.

What am I doing wrong?

update:

full template code

<template>
    <div>
        <div class="tab-content">                
                <item-component 
                    :web-identifier="identifier"
                ></item-component>
        </div>
    </div>

</template>


<script>
export default {
   props: ['identifier'],
    methods: {
        getInformation() {
            this.$root.$emit('fetchEvent');
        },
    },
    mounted () {
        console.dir(this.identifier);
    }
}
</script>

blade:

<div>
<task-detail-component></task-detail-component>
</div>
2
how do you pass the prop in your progress templateBoussadjra Brahim
The bottom section of code is my progress template. I guess that's what I'm not sure of, I'm trying to make identifier accessible within the template through propsGeoff_S
please share the progress template codeBoussadjra Brahim
@BoussadjraBrahim there isn't much else but I shared itGeoff_S
where and how you're calling that component in blade templateBoussadjra Brahim

2 Answers

2
votes

in blade template pass that data as follows :

<div>
<task-detail-component :identifier="{{$identifier}}"></task-detail-component>
</div>
0
votes

in your template where you need to pass your identifier it will be like this

<div>
<task-detail-component :identifier="{{$identifier}}"></task-detail-component>
</div>