Skip to content

Instantly share code, notes, and snippets.

@MarGul
Created April 14, 2018 09:26
Show Gist options
  • Save MarGul/bc7ba9e0c7d94f601df80a7a9092313d to your computer and use it in GitHub Desktop.
Save MarGul/bc7ba9e0c7d94f601df80a7a9092313d to your computer and use it in GitHub Desktop.
// show.blade.php
@foreach( $arguments as $argument )
<argument :argument="{{ json_encode($argument) }}" >
<p>{{ $argument['text'] }}</p>
</argument>
@endforeach
// Argument.vue
<template>
<div class="bg-white p-4">
<slot></slot>
<p>
{{ count }} <button type="button" @click="increment">Increment</button>
</p>
</div>
</template>
<script>
export default {
name: 'Argument',
props: {
argument: {
type: Object,
required: true
}
},
data() {
return {
count: this.argument.count
}
},
methods: {
increment() {
this.count++;
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment