Selaa lähdekoodia

文字提示指令更新

Xiao_123 4 kuukautta sitten
vanhempi
commit
a23db17bb7

+ 0 - 124
src/components/CtTooltip/index.js

@@ -1,124 +0,0 @@
-// 引入组件
-import {createApp, nextTick} from "vue";
-import MyToolTip from './ToolTip.vue'
-
-/**
- * v-ellipse-tooltip.top
-*/
-
-// 位置定位
-function calculationLocation(el, target, placements) {
-  if (!el || !target) return;
-  el.tooltipPosition.y = 0;
-  el.tooltipPosition.x = 0;
-  let el_dom = el.$el.nextElementSibling.getBoundingClientRect()
-  let target_dom = target.getBoundingClientRect()
-
-  if (placements === "left") {
-    el.tooltipPosition.x = target_dom.x - el_dom.width - 10
-    el.tooltipPosition.y = target_dom.y - el_dom.height / 2 + target_dom.height / 2
-  } else if (placements === "bottom") {
-    el.tooltipPosition.x = target_dom.x + target_dom.width / 2 - el_dom.width / 2
-    el.tooltipPosition.y = target_dom.y + el_dom.height + 10
-  } else if (placements === "right") {
-    el.tooltipPosition.x = target_dom.x + target_dom.width + 10
-    el.tooltipPosition.y = target_dom.y - el_dom.height / 2 + target_dom.height / 2
-  } else if (placements === "top") {
-    el.tooltipPosition.x = target_dom.x + target_dom.width / 2 - el_dom.width / 2
-    el.tooltipPosition.y = target_dom.y - el_dom.height - 10
-  }
-}
-
-// 方向
-const allPlacements = ['left', 'bottom', 'right', 'top']
-
-
-function getElStyleAttr(element, attr) {
-  const styles = window.getComputedStyle(element)
-  return styles[attr]
-}
-
-// const getPosition = (target) => {
-//   const x = target.offsetLeft + target.offsetWidth/2
-//   const y = target.offsetTop + target.offsetHeight/2
-//   return { x, y}
-// }
-
-const isOverflow = (target) => {
-  const scrollWidth = target.scrollWidth
-  const offsetWidth = target.offsetWidth
-  // const range = document.createRange()
-  // range.setStart(target, 0)
-  // range.setEnd(target, target.childNodes.length)
-  // const rangeWidth = range.getBoundingClientRect().width
-  // const padding = (parseInt(getElStyleAttr(target, 'paddingLeft'), 10) || 0) + (parseInt(getElStyleAttr(target, 'paddingRight'), 10) || 0)
-  // return (rangeWidth + padding > target.offsetWidth) || scrollWidth > offsetWidth
-  return scrollWidth > offsetWidth
-}
-
-export const ellipsisTooltip = {
-  mounted(el, binding) {
-    //获取指令的参数
-    const {
-        value: {
-            placement, content, destroyOnLeave
-        } = {}
-    } = binding;
-    // 加上超出...样式
-    el.style.overflow = "hidden";
-    el.style.textOverflow = "ellipsis";
-    el.style.whiteSpace = "nowrap";
-    //鼠标移开时 清除元素
-    const onMouseLeave = () => {
-      if (el.w_tipInstance) {
-        el.w_tipInstance.hiddenTip()
-        el.w_tooltip.remove()
-        el.w_tipInstance = null
-        el.w_tooltip = null
-      }
-    };
-    const onMouseEnter = () => {
-      // 判断内容长度 需要展示
-      if (isOverflow(el)) {
-        // const positionXY = getPosition(el)
-        const directiveList = allPlacements.filter(placement => binding.modifiers[placement])
-        const placements = directiveList.length ? directiveList : allPlacements
-        if (!el.w_tooltip) {
-          // 创建tooltip实例
-          const vm = createApp(MyToolTip)
-          // 创建根元素
-          el.w_tooltip = document.createElement('div')
-          // 挂载到页面
-          document.body.appendChild(el.w_tooltip)
-          el.w_tooltip.id = `tooltip_${Math.floor(Math.random() * 10000)}`
-          el.w_tipInstance = vm.mount(el.w_tooltip)
-        }
-        // 设置 tooltip 显示方向
-        el.w_tipInstance.placements = placement || placements[0] || 'top'
-        // 设置显示内容
-        el.w_tipInstance.setContent(content || el.innerText)
-        // 使 tooltip 显示
-        el.w_tipInstance.showTip()
-        nextTick(() => {
-          // 计算 tooltip 在页面中的位置
-          calculationLocation(el.w_tipInstance, el, placements[0])
-        })
-        el._scrollHandler = () => {
-          // 重新定位位置
-          if (el.w_tipInstance && el.w_tipInstance.tooltipShow) calculationLocation(el.w_tipInstance, el, placements[0])
-        }
-        window.addEventListener('scroll', el._scrollHandler)
-        const _destroyOnLeave = destroyOnLeave || true
-        if (_destroyOnLeave) el.addEventListener("mouseleave", onMouseLeave);
-      }
-    };
-    el.addEventListener("mouseenter", onMouseEnter);
-  },
-  unmounted(el) {
-    if (el.w_tooltip) {
-      document.body.removeChild(el.w_tooltip)
-    }
-    window.removeEventListener('scroll', el._scrollHandler)
-  }
-}
-

+ 3 - 3
src/components/Enterprise/hotPromoted.vue

@@ -8,7 +8,7 @@
             <v-img :src="item?.enterprise.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'" alt="" width="77" height="77" style="border-radius: 4px;"/>
           </div>
           <div class="company-info cursor-pointer">
-            <h3 v-ellipse-tooltip.top>{{ formatName(item.enterprise.anotherName || item.enterprise.name) }}</h3>
+            <h3 v-ellipse-tooltip>{{ formatName(item.enterprise.anotherName || item.enterprise.name) }}</h3>
             <!-- <h3 :ref="el => { if(el) companyNameRefs[index] = el }">
               {{ formatName(item.enterprise.anotherName || item.enterprise.name) }}
               <v-tooltip v-if="isTextOverflow[index]" activator="parent" location="top">{{ formatName(item.enterprise.anotherName || item.enterprise.name) }}</v-tooltip>
@@ -20,7 +20,7 @@
             </p>
           </div>
         </div>
-        <div v-ellipse-tooltip.top class="px-5 py-1 ellipsis-tag" :style="{'height': '33px', 'border-bottom': item.enterprise.welfareList && item.enterprise.welfareList.length ? '1px solid #EBEBEB' : 'none'}">
+        <div v-ellipse-tooltip class="px-5 py-1 ellipsis-tag" :style="{'height': '33px', 'border-bottom': item.enterprise.welfareList && item.enterprise.welfareList.length ? '1px solid #EBEBEB' : 'none'}">
           <span class="welfareTag mr-5" v-for="(k, i) in item.enterprise.welfareList" :key="i">{{ k }}</span>
         </div>
         <!-- 职位列表 -->
@@ -29,7 +29,7 @@
           <li v-for="(k, i) in item.jobList" :key="i" @mouseenter="k.active = true" @mouseleave="k.active = false" @click="handleClickPosition(k)">
             <v-card :elevation="k.active ? 5 : 0" class="company-job-item cursor-pointer mb-3">
               <div class="mb-2 d-flex">
-                <span v-ellipse-tooltip.top :class="['name', 'cursor-pointer', {'default-active': k.active }]" :style="{'max-width': !k.payFrom && !k.payTo ? '290px' : '200px'}">{{ formatName(k.name) }}</span>
+                <span v-ellipse-tooltip :class="['name', 'cursor-pointer', {'default-active': k.active }]" :style="{'max-width': !k.payFrom && !k.payTo ? '290px' : '200px'}">{{ formatName(k.name) }}</span>
                 <span v-if="!k.payFrom && !k.payTo" class="salary">面议</span>
                 <span v-else class="salary">{{ k.payFrom ? k.payFrom + '-' : '' }}{{ k.payTo }}{{ k.payName ? '/' + k.payName : '' }}</span>
               </div>

+ 2 - 2
src/components/Position/item.vue

@@ -31,7 +31,7 @@
               <p v-else class="salary">{{ item.payFrom ? item.payFrom + '-' : '' }}{{ item.payTo }}{{ item.payName ? '/' + item.payName : '' }}</p>
             </div>
           </div>
-          <div v-ellipse-tooltip.top class="ellipsis" style="height: 24px;overflow: hidden;">
+          <div v-ellipse-tooltip class="ellipsis" style="height: 24px;overflow: hidden;">
             <span v-for="(j, i) in item.tagList" :key="i" class="mr-3 tags" style="color: #345768;">{{ j }}</span>
           </div>
           <div v-if="tab === 3 && item.hire" class="text-end mt-3">
@@ -46,7 +46,7 @@
               <v-avatar size="35">
                 <v-img :src="item.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'" />
               </v-avatar>
-              <span v-ellipse-tooltip.top class="names ml-2 font-size-14 ellipsis" style="max-width: 88%;">
+              <span v-ellipse-tooltip class="names ml-2 font-size-14 ellipsis" style="max-width: 88%;">
                 {{ formatName(item.anotherName || item.enterpriseName) }}
                 <span class="color-999 font-size-13 ml-3">
                   <span>{{ item.industryName }}</span>

+ 3 - 3
src/components/PositionLongStrip/item.vue

@@ -11,8 +11,8 @@
           </div>
           <div>
             <div class="d-flex">
-              <p v-ellipse-tooltip.top v-if="item.job.name.indexOf('style')" v-html="item.job.name" :class="['title1', {'default-active': item.positionActive }]"></p>
-              <p v-else v-ellipse-tooltip.top :class="['title1', {'default-active': item.positionActive }]">{{ formatName(item.job.name) }}{{ item.job.pos ? ' [' + item.job.pos + '] ' : '' }}</p>
+              <p v-ellipse-tooltip v-if="item.job.name.indexOf('style')" v-html="item.job.name" :class="['title1', {'default-active': item.positionActive }]"></p>
+              <p v-else v-ellipse-tooltip :class="['title1', {'default-active': item.positionActive }]">{{ formatName(item.job.name) }}{{ item.job.pos ? ' [' + item.job.pos + '] ' : '' }}</p>
               <p v-if="!item.job.payFrom && !item.job.payTo" class="salary ml-1">面议</p>
               <p v-else class="salary ml-1">{{ item.job.payFrom ? item.job.payFrom + '-' : '' }}{{ item.job.payTo }}{{ item.job.payName ? '/' + item.job.payName : '' }}</p>
               <div v-if="item?.job?.hire">
@@ -50,7 +50,7 @@
               <h3 v-bind="props" v-ellipse-tooltip :class="{'default-active': isHovering }" class="title1">{{ formatName(item.enterprise.anotherName || item.enterprise.name) }}</h3>
             </template>
           </v-hover>
-          <p v-ellipse-tooltip.top class="mt-2" style="max-width: 420px;">
+          <p v-ellipse-tooltip class="mt-2" style="max-width: 420px;">
             {{ item.enterprise.scaleName }}
             <span class="mx-2" v-if="item.enterprise.scaleName && item.enterprise.industryName">|</span>
             {{ item.enterprise.industryName }}

+ 189 - 0
src/directives/ellipsisTooltip/index.js

@@ -0,0 +1,189 @@
+/* 
+    文档来源 https://blog.csdn.net/weixin_41277748/article/details/138855857
+    代码来源 https://github.com/DearWQ/wq-admin-system/blob/main/src/directive/toolTip/MyToolTip.vue
+*/
+
+// 引入组件
+import {createApp, nextTick} from "vue";
+import MyToolTip from './index.vue'
+
+function getViewportSize() {
+    return {
+        windowWidth: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
+        windowHeight: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
+    };
+}
+
+let windowWidth = getViewportSize().windowWidth
+let windowHeight = getViewportSize().windowHeight
+
+
+
+// 位置定位
+function calculationLocation(el, target, placements) {
+    if (!el || !target) return;
+    el.tooltipPosition.y = 0;
+    el.tooltipPosition.x = 0;
+    let el_dom = target.w_tooltip.firstElementChild.getBoundingClientRect()
+    let target_dom = target.getBoundingClientRect()
+    if (placements === "left") {
+        el.tooltipPosition.x = 0
+        el.tooltipPosition.y = target_dom.y - target_dom.height / 2 + 14
+        el.tooltipPosition.right = windowWidth - target_dom.left + target_dom.height / 2 - 22
+    } else if (placements === "left-right") {
+        el.tooltipPosition.x = 0
+        el.tooltipPosition.y = target_dom.y - (el_dom?.height || 0) / 2 + target_dom.height / 2
+        el.tooltipPosition.left = target_dom.left + target_dom.width + 10
+    } else if (placements === "bottom") {
+        el.tooltipPosition.x = target_dom.x + target_dom.width / 2 - (el_dom?.width || 0) / 2
+        el.tooltipPosition.y = target_dom.y + target_dom.height + 10
+        if (el.tooltipPosition.x > (windowWidth-el_dom.width) && target_dom.left + el_dom.width > windowWidth) {
+            el.tooltipPosition.x = windowWidth - el_dom.width
+            el.arrowPosition.left = (el_dom.width / 10) * 8
+        }
+        if (el.tooltipPosition.x < 0) {
+            el.arrowPosition.left = (el_dom.width / 10) * 2
+        }
+
+    } else if (placements === "right") {
+        el.tooltipPosition.x = 0
+        el.tooltipPosition.y = target_dom.y - (el_dom?.height || 0) / 2 + target_dom.height / 2
+        el.tooltipPosition.left = target_dom.left + target_dom.width + 10
+    } else if (placements === "right-left") {
+        //提示文字的位置
+        el.tooltipPosition.x = 0;
+        el.tooltipPosition.y = target_dom.y - target_dom.height / 2;
+        el.tooltipPosition.right = windowWidth - target_dom.left + target_dom.height / 2
+        //三角形的位置
+        el.arrowPosition.top = target_dom.height
+    } else if (placements === "top") {
+        el.tooltipPosition.x = target_dom.x + target_dom.width / 2 - (el_dom?.width || 0) / 2
+        el.tooltipPosition.y = target_dom.y - target_dom.height - 21
+        if (el.tooltipPosition.x > (windowWidth-el_dom.width) && target_dom.left + el_dom.width > windowWidth) {
+            el.tooltipPosition.x = windowWidth - el_dom.width
+            el.arrowPosition.left = (el_dom.width / 10) * 9
+        }
+        if (el.tooltipPosition.x < 0) {
+            el.arrowPosition.left = (el_dom.width / 10) * 2
+        }
+    }
+    el.tooltipPosition.x = el.tooltipPosition.x < 0 ? 0 : el.tooltipPosition.x
+    el.tooltipPosition.y = el.tooltipPosition.y < 0 ? 0 : el.tooltipPosition.y
+}
+
+/**
+ * 处理边界情况
+ * @param  {HTMLElement} el
+ * @param direction
+ * return {string} props
+ */
+function dealDomBoundary(el, direction) {
+    let target_dom = el.getBoundingClientRect()
+    //处理上下左右边界情况
+    if (target_dom.left < 150 && direction === 'left') {
+        direction = 'left-right'
+    }
+
+    if (target_dom.right > (windowWidth - 150) && direction === 'right') {
+        direction = 'right-left'
+    }
+    if (target_dom.top > windowHeight / 100 * 90 && direction === 'bottom') {
+        direction = 'top'
+    }
+    if (target_dom.top < windowHeight / 100 * 10 && direction === 'top') {
+        direction = 'bottom'
+    }
+    return direction
+}
+
+// 方向
+const allPlacements = ['top', 'bottom', 'right', 'left']
+
+
+// function getElStyleAttr(element, attr) {
+//     const styles = window.getComputedStyle(element)
+//     return styles[attr]
+// }
+
+const isOverflow = (target) => {
+    const scrollWidth = target.scrollWidth
+    const offsetWidth = target.offsetWidth
+    // const range = document.createRange()
+    // range.setStart(target, 0)
+    // range.setEnd(target, target.childNodes.length)
+    // const rangeWidth = range.getBoundingClientRect().width
+    // const padding = (parseInt(getElStyleAttr(target, 'paddingLeft'), 10) || 0) + (parseInt(getElStyleAttr(target, 'paddingRight'), 10) || 0)
+    // return (rangeWidth + padding > target.offsetWidth) || scrollWidth > offsetWidth
+    return  scrollWidth > offsetWidth
+}
+
+const closeTooltip = false
+
+export const ellipsisTooltip = closeTooltip ? {} : {
+    mounted(el, binding) {
+        //获取指令的参数
+        const {
+            value: {
+                placement, content, destroyOnLeave
+            } = {}
+        } = binding;
+        // 加上超出...样式
+        el.style.overflow = "hidden";
+        el.style.textOverflow = "ellipsis";
+        el.style.whiteSpace = "nowrap";
+        windowWidth = getViewportSize().windowWidth
+        windowHeight = getViewportSize().windowHeight
+        //鼠标移开时 清除元素
+        const onMouseLeave = () => {
+            if (el.w_tipInstance) {
+                el.w_tipInstance.hiddenTip()
+                el.w_tooltip.remove()
+                el.w_tipInstance = null
+                el.w_tooltip = null
+            }
+        };
+        const onMouseEnter = () => {
+            // 判断内容长度 需要展示
+            if (isOverflow(el)) {
+                const directiveList = allPlacements.filter(placement => binding.modifiers[placement])
+                const placements = directiveList.length ? directiveList : allPlacements
+                if (!el.w_tooltip) {
+                    // 创建tooltip实例
+                    const vm = createApp(MyToolTip)
+                    // 创建根元素
+                    el.w_tooltip = document.createElement('div')
+                    // 挂载到页面
+                    document.body.appendChild(el.w_tooltip)
+                    el.w_tooltip.id = `tooltip_${Math.floor(Math.random() * 10000)}`
+                    el.w_tipInstance = vm.mount(el.w_tooltip)
+                }
+                // 设置 tooltip 显示方向 处理边界情况
+                let direction = dealDomBoundary(el, placement || placements[0] || 'top')
+
+                el.w_tipInstance.placements = direction;
+                // 设置显示内容
+                el.w_tipInstance.setContent(content || el.innerText)
+                // 使 tooltip 显示
+                el.w_tipInstance.showTip()
+                nextTick(() => {
+                    // 计算 tooltip 在页面中的位置
+                    calculationLocation(el.w_tipInstance, el, direction)
+                })
+                el._scrollHandler = () => {
+                    // 重新定位位置
+                    if (el.w_tipInstance) calculationLocation(el.w_tipInstance, el, placements[0])
+                }
+                window.addEventListener('scroll', el._scrollHandler)
+                const _destroyOnLeave = destroyOnLeave || true
+                if (_destroyOnLeave) el.addEventListener("mouseleave", onMouseLeave);
+            }
+        };
+        el.addEventListener("mouseenter", onMouseEnter);
+    },
+    unmounted(el) {
+        if (el.w_tooltip) {
+            document.body.removeChild(el.w_tooltip)
+        }
+        window.removeEventListener('scroll', el._scrollHandler)
+    }
+}

+ 63 - 35
src/components/CtTooltip/ToolTip.vue → src/directives/ellipsisTooltip/index.vue

@@ -1,30 +1,24 @@
 <template>
-  <!-- 指示 -->
-  <transition name="el-fade-in-linear">
+  <!--提示-->
+  <transition name="fade-in-linear">
     <div v-show="tooltipShow" :style="tooltipStyle" class="wq-tooltip"
     >
       <span class="wq-tooltip-text" v-text="text"></span>
-      <!-- 箭头 -->
-      <!-- <div :class="[
-        {'left':placements === 'left'},
-        {'bottom':placements==='bottom'},
-        {'right':placements==='right'},
-        {'top':placements==='top'}]" 
-        class="wq-tooltip-arrow"
-      >
-      </div> -->
+      <div v-show="showArrow" :class="[placements]" :style="arrowStyle" class="wq-tooltip-arrow"></div>
     </div>
   </transition>
 </template>
-
 <script>
-import {ref, computed } from 'vue'
+import {computed, ref} from 'vue'
 
 export default {
   setup() {
     // 显示弹框
     const tooltipShow = ref(false);
 
+    // 显示箭头
+    const showArrow = ref(false);
+
     // 提示内容
     const text = ref()
 
@@ -35,10 +29,12 @@ export default {
     function showTip() {
       tooltipShow.value = true
     }
+
     //设置提示内容
     function setContent(content) {
       text.value = content
     }
+
     //隐藏
     function hiddenTip() {
       tooltipShow.value = false
@@ -47,20 +43,46 @@ export default {
     // 位置
     const tooltipPosition = ref({
       x: 0,
-      y: 0
+      y: 0,
+      width: 0,
+      left: 0,
+      top: 0,
+      right: 0,
+      bottom: 0,
+    })
+    const arrowPosition = ref({
+      left: 0,
+      top: 0,
+      right: 0,
+      bottom: 0,
     })
     const tooltipStyle = computed(() => {
       return {
-        transform: `translate3d(${tooltipPosition.value.x}px,${tooltipPosition.value.y}px,0)`
+        transform: `translate3d(${tooltipPosition.value.x}px,${tooltipPosition.value.y}px,0)`,
+        width: tooltipPosition.value.width ? `${tooltipPosition.value.width}px` : null,
+        right: tooltipPosition.value.right ? `${tooltipPosition.value.right}px` : null,
+        left: tooltipPosition.value.left ? `${tooltipPosition.value.left}px` : null,
+        top: tooltipPosition.value.top ? `${tooltipPosition.value.top}px` : null,
       }
     })
+    const arrowStyle = computed(() => {
+      return showArrow.value ? {
+        left: arrowPosition.value.left?`${arrowPosition.value.left}px` : null,
+        top: arrowPosition.value.top?`${arrowPosition.value.top}px` : null,
+        right: arrowPosition.value.right?`${arrowPosition.value.right}px` : null,
+        bottom: arrowPosition.value.bottom?`${arrowPosition.value.bottom}px` : null,
+      } : {}
+    })
     return {
+      showArrow,
       tooltipShow,
       showTip,
       hiddenTip,
       setContent,
       tooltipPosition,
+      arrowPosition,
       tooltipStyle,
+      arrowStyle,
       text,
       placements,
     }
@@ -72,24 +94,20 @@ export default {
 // tooltip
 .wq-tooltip {
   padding: 5px 16px;
-  font-size: .875rem;
+  font-size: 14px;
   line-height: 1.6;
-  min-width: 10px;
+  min-width: 30px;
+  max-width: fit-content;
   word-wrap: break-word;
   position: fixed;
-  left: 0;
   top: 0;
-  pointer-events: none;
-  background: rgb(66, 66, 66);
-  color: rgb(238, 238, 238);
-  border-radius: 4px;
-  font-size: .875rem;
-  line-height: 1.6;
+  background: rgb(66,66,66);
+  color: rgb(238,238,238);
+  z-index: 1000;
   display: block;
-  z-index: 2000;
-  opacity: 1;
-  width: auto;
-  transition-property: opacity,width;
+  border-radius: 4px;
+  font-weight: 500;
+  pointer-events: none;
 }
 
 // 小箭头
@@ -101,15 +119,21 @@ export default {
   border-style: solid;
 }
 
-// 小箭头如果在左侧
+// 如果在左侧
 .wq-tooltip-arrow.left {
   border-color: transparent transparent transparent #303133;
   right: -15px;
   top: 50%;
   transform: translate3d(0, -50%, 0);
 }
+.wq-tooltip-arrow.left-right {
+  left: -15px;
+  top: 50%;
+  transform: translate3d(0, -50%, 0);
+  border-color: transparent #303133 transparent transparent;
+}
 
-// 小箭头如果在下侧
+// 如果在下侧
 .wq-tooltip-arrow.bottom {
   top: -15px;
   border-color: transparent transparent #303133 transparent;
@@ -117,15 +141,20 @@ export default {
   transform: translate3d(-50%, 0, 0);
 }
 
-// 小箭头如果在右侧
+// 如果在右侧
 .wq-tooltip-arrow.right {
   left: -15px;
   top: 50%;
   transform: translate3d(0, -50%, 0);
   border-color: transparent #303133 transparent transparent;
 }
-
-// 小箭头如果在上侧
+.wq-tooltip-arrow.right-left {
+  border-color: transparent transparent transparent #303133;
+  right: -15px;
+  top: 50%;
+  transform: translate3d(0, -50%, 0);
+}
+// 如果在上侧
 .wq-tooltip-arrow.top {
   bottom: -15px;
   border-color: #303133 transparent transparent transparent;
@@ -144,5 +173,4 @@ export default {
 .tooltip-enter-to {
   transition: opacity .1s ease;
 }
-</style>
-
+</style>

+ 3 - 1
src/main.js

@@ -31,7 +31,8 @@ import VueLuckyCanvas from '@lucky-canvas/vue'
 
 import router from './router'
 
-import { ellipsisTooltip } from '@/components/CtTooltip/index.js'
+import { ellipsisTooltip } from '@/directives/ellipsisTooltip/index.js'
+// import imageDirective from '@/directives/previewImageDirective'
 
 import './permission'
 
@@ -47,6 +48,7 @@ app.use(pinia)
 app.use(router)
 app.use(Clipboard)
 app.use(VueLuckyCanvas)
+// imageDirective(app)
 
 
 // app.config.globalProperties.$echarts = echarts

+ 2 - 2
src/views/recruit/personal/recommend/components/positionList.vue

@@ -11,7 +11,7 @@
         <div class="job-info">
           <div class="sub-li-top">
             <div class="sub-li-info">
-              <p v-ellipse-tooltip.top :class="['name', {'default-active': item.active }]">{{ formatName(item.name) }}</p>
+              <p v-ellipse-tooltip :class="['name', {'default-active': item.active }]">{{ formatName(item.name) }}</p>
               <svg-icon v-if="item.hire" name="pin" size="30"></svg-icon>
             </div>
           </div>
@@ -40,7 +40,7 @@
               <v-avatar size="35">
                 <v-img :src="item.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'" />
               </v-avatar>
-              <span v-ellipse-tooltip.top class="names ml-2 font-size-14 ellipsis" style="max-width: 88%;">
+              <span v-ellipse-tooltip class="names ml-2 font-size-14 ellipsis" style="max-width: 88%;">
                 {{ formatName(item.anotherName || item.name) }}
                 <span class="color-999 font-size-13 ml-3">
                   <span>{{ item.industryName }}</span>