Just to add for those who still get error.
For me this <askquestionmodal :product="{{ $item->title }}"></askquestionmodal>
still gives error in console and instead showing html page I saw white screen.
[Vue warn]: Error compiling template:
invalid expression: Unexpected identifier in
Coupling to connect 2 rods М14 CF-10
Raw expression: :product="Coupling to connect 2 rods М14 CF-10"
Though in error I can see that $item->title is replaced with its value.
So then I tried to do like that <askquestionmodal :product="'{{ $item->title }}'"></askquestionmodal>
And I have fully working code.
/components/askquestionmodal.vue
<template>
<div class="modal-body">
<p>{{ product }}</p>
</div>
</template>
<script>
export default {
name: "AskQuestionModal",
props: ['product'],
mounted() {
console.log('AskQuestionModal component mounted.')
}
}
</script>
<span hashid="{{ Auth::user()->id }}"></span>
and in your vue component do like:<script> export default { data: function () { return { hashid: '' } } } </script>
and console it anywhere, it'll give you auth id! – Hiren Gohel