0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Component UIのテーブル内でHTMLを有効化したい

Posted at

Componentテーブル内に表示するデータをHTMLを表示したいと考えてはまった時のメモ。
データそのものは有効化できなかったが、以下の方法で目的が達成できた。

変更前

name_telデータ内でHTMLデータを記載すると、そのままエスケープされて出てきてしまう。

// 氏名と電話をまとめて取得
<el-table-column
 prop="name_tel"
 label="氏名"
 width="200px">
</el-table-column>

変更後

<template>で表示内容を分岐させて、装飾させて解決。

// 氏名と電話を分けて取得し、分けて表示
<el-table-column
 prop="name_tel"
 label="氏名">
  <template slot-scope="scope">
   <div>{{ scope.row.name}}</div>
   <div v-if="scope.row.tel"><i class="fas fa-phone-square"></i>{{ scope.row.tel }}</div>
  </template>
</el-table-column>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?