lifanagju_citu 4 ヶ月 前
コミット
d9482ba7b3
2 ファイル変更5 行追加2 行削除
  1. 2 2
      src/components/CtTooltip/ToolTip.vue
  2. 3 0
      src/components/CtTooltip/index.js

+ 2 - 2
src/components/CtTooltip/ToolTip.vue

@@ -18,7 +18,7 @@
 </template>
 
 <script>
-import {ref, computed } from 'vue'
+import {ref, computed, reactive } from 'vue'
 
 export default {
   setup() {
@@ -45,7 +45,7 @@ export default {
     }
 
     // 位置
-    const tooltipPosition = ref({
+    const tooltipPosition = reactive({
       x: 0,
       y: 0
     })

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

@@ -14,6 +14,9 @@ function calculationLocation(el, target, placements) {
   let el_dom = el.$el.nextElementSibling.getBoundingClientRect()
   let target_dom = target.getBoundingClientRect()
 
+  console.log('el_dom:', el_dom)
+  console.log('target_dom:', target_dom)
+
   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