这是我的刀片代码
<div id="app">
<Testcomponent bam-wam="ham" />
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的VueJS组件代码
<script>
export default {
name: "ExampleComponent",
props: [
'bamWam'
],
data () {
return {
};
},
created() {
console.log(this.bamWam);
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
问题是
这段代码运行良好,但我想问什么更好用Axios和Vuex从我的Laravel应用程序中获取数据或者只是像我在这段代码中那样传递数据抛出道具?
我正在使用Vue + Vuetify,我正在尝试在第一列中添加图像。
表格模板代码
<v-data-table
:headers="headers"
:items="desserts"
:search="search"
light
>
<template slot="items" slot-scope="props">
<td><img :src="props.item.name" style="width: 50px; height: 50px"></td>
<td class="text-xs-right">{{ props.item.calories }}</td>
<td class="text-xs-right">{{ props.item.fat }}</td>
<td class="text-xs-right">{{ props.item.carbs }}</td>
<td class="text-xs-right">{{ props.item.protein }}</td>
<td class="text-xs-right">{{ props.item.iron }}</td>
</template>
<v-alert slot="no-results" :value="true" dir="rtl" color="error" icon="warning">
{{ PRODUCTS_TABLE_TEXT.NO_RESULT }} "{{ search }}"
</v-alert>
</v-data-table>
Run Code Online (Sandbox Code Playgroud)
表脚本代码
data () {
return {
//TEXT
PRODUCTS_TABLE_TEXT: products_table_text,
//TABLE DATA
search: '',
headers: [
{
text: products_table_text.columns.IMAGE,
align: 'center',
sortable: false,
value: 'image' …Run Code Online (Sandbox Code Playgroud)