elementui中el-popover里面的內(nèi)容怎么用html寫(xiě)?content 顯示的內(nèi)容,也可以通過(guò) slot 傳入 DOM

image.png

這個(gè)屬性怎么用的
我們可以看一下源碼

<template>
  <span>
    <transition
      :name="transition"
      @after-enter="handleAfterEnter"
      @after-leave="handleAfterLeave">
      <div
        class="el-popover el-popper"
        :class="[popperClass, content && 'el-popover--plain']"
        ref="popper"
        v-show="!disabled && showPopper"
        :style="{ width: width + 'px' }"
        role="tooltip"
        :id="tooltipId"
        :aria-hidden="(disabled || !showPopper) ? 'true' : 'false'"
      >
        <div class="el-popover__title" v-if="title" v-text="title"></div>
        <slot>{{ content }}</slot>
      </div>
    </transition>
    <slot name="reference"></slot>
  </span>
</template>

其中 <slot>{{ content }}</slot>
內(nèi)容可以以插槽的形式傳入,所以前端可以直接在el-popover組件里寫(xiě)html內(nèi)容

<el-popover
                placement="top-start"
                title="作者簡(jiǎn)介"
                width="400"
                trigger="hover"
              >
                <ul class="tips-content">
                  <li>昵稱:webrabbit</li>
                  <li>郵箱:
                    <a
                      href="mailto:admin@websmallrabbit.com"
                      target="_blank"
                      data-toggle="tooltip"
                      rel="nofollow"
                      data-placement="bottom"
                      title=""
                      data-original-title="Email:admin@websmallrabbit.com"
                    >admin@websmallrabbit.com</a>
                  </li>
                  <li>個(gè)人網(wǎng)址:
                    <a  title="http://websmallrabbit.github.io/" target="_blank">http://websmallrabbit.github.io/</a>
                  </li>
                </ul>
                <span slot="reference">
                  <a class="address">webrabbit博客</a>
                </span>
              </el-popover>

顯示


image.png

如果你還喜歡歡迎點(diǎn)贊關(guān)注 ??????

image.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • VUE介紹 Vue的特點(diǎn)構(gòu)建用戶界面,只關(guān)注View層簡(jiǎn)單易學(xué),簡(jiǎn)潔、輕量、快速漸進(jìn)式框架 框架VS庫(kù)庫(kù),是一封裝...
    多多醬_DuoDuo_閱讀 2,853評(píng)論 1 17
  • Vue 實(shí)例 屬性和方法 每個(gè) Vue 實(shí)例都會(huì)代理其 data 對(duì)象里所有的屬性:var data = { a:...
    云之外閱讀 2,361評(píng)論 0 6
  • 什么是組件? 組件 (Component) 是 Vue.js 最強(qiáng)大的功能之一。組件可以擴(kuò)展 HTML 元素,封裝...
    youins閱讀 9,699評(píng)論 0 13
  • 一、了解Vue.js 1.1.1 Vue.js是什么? 簡(jiǎn)單小巧、漸進(jìn)式、功能強(qiáng)大的技術(shù)棧 1.1.2 為什么學(xué)習(xí)...
    蔡華鵬閱讀 3,492評(píng)論 0 3
  • ——2019年3月1日日記 如果一個(gè)人還能夠撕心裂肺地大哭一場(chǎng),把胸腔里的委屈怨恨通通發(fā)泄出來(lái),把對(duì)自己的不滿對(duì)世...
    An夏秋閱讀 318評(píng)論 0 0

友情鏈接更多精彩內(nèi)容