小编Dil*_*ill的帖子

将数据从Laravel传递到Vue组件的最佳实践

这是我的刀片代码

<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应用程序中获取数据或者只是像我在这段代码中那样传递数据抛出道具

laravel vue.js vuex

7
推荐指数
2
解决办法
6729
查看次数

Vue + Vuetify 数据表第一列图片

我正在使用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)

vue.js vuejs2 vuetify.js vue-data-tables

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

vue.js ×2

laravel ×1

vue-data-tables ×1

vuejs2 ×1

vuetify.js ×1

vuex ×1