最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I use v-html in customized default rows in the table using Vuetify 2.x? - Stack Overflow

programmeradmin0浏览0评论

I am starting to use Vuetify 2.x.

I have a table and some column should be shown with html.

So I used below code:

        <v-data-table
          :headers="headers"
          :items="decorations"
          :items-per-page-options="[20]"
          class="elevation-1"
        >
          <template v-slot:items="props">
            <tr>
              <td class="text-sm-center">{{ props.item.name}}</td>
              <td><span v-html="props.item.desc"></span></td>
            </tr>
          </template>
        </v-data-table>

But from Vuetify 2.0, table has been changed.

        <v-data-table
          :headers="headers"
          :items="decorations"
          :items-per-page-options="[20]"
          class="elevation-1"
        >
        </v-data-table>

Not used "template" any more. So I don't know how can I apply "v-html" in some column.

I am starting to use Vuetify 2.x.

I have a table and some column should be shown with html.

So I used below code:

        <v-data-table
          :headers="headers"
          :items="decorations"
          :items-per-page-options="[20]"
          class="elevation-1"
        >
          <template v-slot:items="props">
            <tr>
              <td class="text-sm-center">{{ props.item.name}}</td>
              <td><span v-html="props.item.desc"></span></td>
            </tr>
          </template>
        </v-data-table>

But from Vuetify 2.0, table has been changed.

        <v-data-table
          :headers="headers"
          :items="decorations"
          :items-per-page-options="[20]"
          class="elevation-1"
        >
        </v-data-table>

Not used "template" any more. So I don't know how can I apply "v-html" in some column.

Share Improve this question edited Jul 24, 2020 at 18:34 Boussadjra Brahim 1 asked Jul 25, 2019 at 16:46 dev.farmerdev.farmer 2,8192 gold badges36 silver badges76 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

based on this example you could do it like :

  <v-data-table
          :headers="headers"
          :items="decorations"
          :items-per-page-options="[20]"
          class="elevation-1"
        >
 <template v-slot:item.desc="{ item }">
       <span v-html="props.item.desc"></span>
    </template>
        </v-data-table>
发布评论

评论列表(0)

  1. 暂无评论