How can add bootstrap tooltip inside Vue.js

后端 未结 8 1491
失恋的感觉
失恋的感觉 2020-12-13 13:26

I have a page for listing data from table using Vue.js and Laravel. Listing data is successful. Delete and edit function is going on. For that purpose I have added two

8条回答
  •  自闭症患者
    2020-12-13 13:49

    You will find all the CDNs here without requirement of any registration of directive. Libray was made by Guillaume Chau

    body {
      font-family: sans-serif;
      margin: 42px;
    }
    
    .tooltip {
      display: block !important;
      z-index: 10000;
    }
    
    .tooltip .tooltip-inner {
      background: black;
      color: white;
      border-radius: 16px;
      padding: 5px 10px 4px;
    }
    
    .tooltip .tooltip-arrow {
      width: 0;
      height: 0;
      border-style: solid;
      position: absolute;
      margin: 5px;
      border-color: black;
    }
    
    .tooltip[x-placement^="top"] {
      margin-bottom: 5px;
    }
    
    .tooltip[x-placement^="top"] .tooltip-arrow {
      border-width: 5px 5px 0 5px;
      border-left-color: transparent !important;
      border-right-color: transparent !important;
      border-bottom-color: transparent !important;
      bottom: -5px;
      left: calc(50% - 5px);
      margin-top: 0;
      margin-bottom: 0;
    }
    
    .tooltip[x-placement^="bottom"] {
      margin-top: 5px;
    }
    
    .tooltip[x-placement^="bottom"] .tooltip-arrow {
      border-width: 0 5px 5px 5px;
      border-left-color: transparent !important;
      border-right-color: transparent !important;
      border-top-color: transparent !important;
      top: -5px;
      left: calc(50% - 5px);
      margin-top: 0;
      margin-bottom: 0;
    }
    
    .tooltip[x-placement^="right"] {
      margin-left: 5px;
    }
    
    .tooltip[x-placement^="right"] .tooltip-arrow {
      border-width: 5px 5px 5px 0;
      border-left-color: transparent !important;
      border-top-color: transparent !important;
      border-bottom-color: transparent !important;
      left: -5px;
      top: calc(50% - 5px);
      margin-left: 0;
      margin-right: 0;
    }
    
    .tooltip[x-placement^="left"] {
      margin-right: 5px;
    }
    
    .tooltip[x-placement^="left"] .tooltip-arrow {
      border-width: 5px 0 5px 5px;
      border-top-color: transparent !important;
      border-right-color: transparent !important;
      border-bottom-color: transparent !important;
      right: -5px;
      top: calc(50% - 5px);
      margin-left: 0;
      margin-right: 0;
    }
    
    .tooltip[aria-hidden='true'] {
      visibility: hidden;
      opacity: 0;
      transition: opacity .15s, visibility .15s;
    }
    
    .tooltip[aria-hidden='false'] {
      visibility: visible;
      opacity: 1;
      transition: opacity .15s;
    }
    
    
    
    
    
    

    {{ message }}

    new Vue({ el: '#app', data: { message: 'Hello Vue.js!' } })

    If the tooltip does not show on your page, most probably it is conflicting with some other library or the order of placing the CDNs on the page is not proper. In case your tooltip is being cut off on Chrome (will work in FireFox) due to conflict with bootstrap library, add max-width:100% to tooltip-inner to the v-tooltip style

    .tooltip .tooltip-inner {
      **max-width:100%;**
      background: black;
      color: white;
      border-radius: 16px;
      padding: 5px 10px 4px;
    }
    

提交回复
热议问题