StandAloneImg.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  1. <template>
  2. <svg
  3. class="stand-alone-img"
  4. viewBox="0 0 1570 1070"
  5. version="1.1"
  6. xmlns="http://www.w3.org/2000/svg"
  7. xmlns:xlink="http://www.w3.org/1999/xlink"
  8. xml:space="preserve"
  9. :width="svgWidth"
  10. :height="svgHeight"
  11. >
  12. <defs>
  13. <!-- 变桨 -->
  14. <path
  15. class="stand-alone-img-path"
  16. id="pitch"
  17. fill="#BA3237"
  18. opacity="0.6"
  19. stroke="#05BB4C"
  20. stroke-width="6"
  21. d="M27.62,60.304l160.03,48.361l3.518,29.016L3,84.044c0,0,2.227-9.026,8.605-15.174C17.522,63.166,27.62,60.304,27.62,60.304z"
  22. />
  23. <!-- 机舱 -->
  24. <path
  25. class="stand-alone-img-path"
  26. id="engine-room"
  27. fill="#BA3237"
  28. opacity="0.6"
  29. stroke="#05BB4C"
  30. stroke-width="6"
  31. d="M295.172,87.062c-3.13-13.486-14.851-16.73-14.851-16.73L-468.878-79.698l-16.143-12.344l-63.62-24.688l-11.395,5.697l-126.291-47.478c0,0-35.843,9.664-58.729,35.366c-35.833,40.244-64.713,103.269-64.713,103.269l-0.949,24.688L79.016,185.228c0,0,12.043,3.038,24.665,4.067c10.436,0.853,21.862-0.27,21.862-0.27l167.122-65.519C292.665,123.507,298.214,100.157,295.172,87.062z"
  32. />
  33. <!-- 齿轮箱 -->
  34. <path
  35. class="stand-alone-img-path"
  36. id="gear-box"
  37. fill="#BA3237"
  38. opacity="0.6"
  39. stroke="#05BB4C"
  40. stroke-width="6"
  41. d="M177.396,18.822L86.052,2.504L11.984,177.197l88.787,16.317l43.275-98.657l31.637,6.959l4.997-19.08l-27.789-6.13L177.396,18.822z"
  42. />
  43. <!-- 发电机 -->
  44. <path
  45. class="stand-alone-img-path"
  46. id="alternator"
  47. fill="#BA3237"
  48. opacity="0.6"
  49. stroke="#05BB4C"
  50. stroke-width="6"
  51. d="M14.016,175.068L118.433,198.6l30.883-99.516l18.095-54.753l12.79-13.878L39.996,2.021L22.838,55.454L14.016,175.068z"
  52. />
  53. <!-- 偏航 -->
  54. <path
  55. class="stand-alone-img-path"
  56. id="yaw"
  57. fill="#BA3237"
  58. opacity="0.6"
  59. stroke="#05BB4C"
  60. stroke-width="6"
  61. d="M210.152,130.465l-68.025-12.017c0,0-75.83,0.199-135.799-12.484c-67.41-14.257-97.892-41.659-97.892-41.659s-11.844,12.318,2.256,25.502c20.491,19.159,98.496,43.978,176.047,51.625c97.358,9.599,181.853,1.301,181.853,1.301l1.241-10.201L210.152,130.465z"
  62. />
  63. <!-- 液压 -->
  64. <path
  65. class="stand-alone-img-path"
  66. id="hydraulic-pressure"
  67. fill="#BA3237"
  68. opacity="0.6"
  69. stroke="#05BB4C"
  70. stroke-width="6"
  71. d="M82.965,111.483l7.241-72.311l-56.954-8.682L3,181.489l44.656,0.79c0.946,1.133,82.424,16.771,82.424,16.771l7.024-83.744L82.965,111.483z"
  72. />
  73. <!-- 圆圈圈 -->
  74. <g id="stand-alone-circle-bj">
  75. <circle
  76. :class="{
  77. 'stand-alone-circle1': StandAloneCircle1 && hover == 3,
  78. }"
  79. cx="0"
  80. cy="0"
  81. r="10"
  82. fill="#edbf03"
  83. />
  84. <circle
  85. :class="{
  86. 'stand-alone-circle2': StandAloneCircle2 && hover == 3,
  87. }"
  88. cx="0"
  89. cy="0"
  90. r="20"
  91. fill="none"
  92. stroke="#edbf03"
  93. stroke-width="2"
  94. />
  95. <circle
  96. :class="{
  97. 'stand-alone-circle3': StandAloneCircle3 && hover == 3,
  98. }"
  99. cx="0"
  100. cy="0"
  101. r="30"
  102. fill="none"
  103. stroke="#edbf03"
  104. stroke-width="1"
  105. />
  106. <circle
  107. :class="{
  108. 'stand-alone-circle4': StandAloneCircle4 && hover == 3,
  109. }"
  110. cx="0"
  111. cy="0"
  112. r="45"
  113. fill="none"
  114. stroke="#edbf03"
  115. stroke-width="1"
  116. />
  117. </g>
  118. <g id="stand-alone-circle-jc">
  119. <circle
  120. :class="{
  121. 'stand-alone-circle1': StandAloneCircle1 && hover == 6,
  122. }"
  123. cx="0"
  124. cy="0"
  125. r="10"
  126. fill="#edbf03"
  127. />
  128. <circle
  129. :class="{
  130. 'stand-alone-circle2': StandAloneCircle2 && hover == 6,
  131. }"
  132. cx="0"
  133. cy="0"
  134. r="20"
  135. fill="none"
  136. stroke="#edbf03"
  137. stroke-width="2"
  138. />
  139. <circle
  140. :class="{
  141. 'stand-alone-circle3': StandAloneCircle3 && hover == 6,
  142. }"
  143. cx="0"
  144. cy="0"
  145. r="30"
  146. fill="none"
  147. stroke="#edbf03"
  148. stroke-width="1"
  149. />
  150. <circle
  151. :class="{
  152. 'stand-alone-circle4': StandAloneCircle4 && hover == 6,
  153. }"
  154. cx="0"
  155. cy="0"
  156. r="45"
  157. fill="none"
  158. stroke="#edbf03"
  159. stroke-width="1"
  160. />
  161. </g>
  162. <g id="stand-alone-circle-clx">
  163. <circle
  164. :class="{
  165. 'stand-alone-circle1': StandAloneCircle1 && hover == 2,
  166. }"
  167. cx="0"
  168. cy="0"
  169. r="10"
  170. fill="#edbf03"
  171. />
  172. <circle
  173. :class="{
  174. 'stand-alone-circle2': StandAloneCircle2 && hover == 2,
  175. }"
  176. cx="0"
  177. cy="0"
  178. r="20"
  179. fill="none"
  180. stroke="#edbf03"
  181. stroke-width="2"
  182. />
  183. <circle
  184. :class="{
  185. 'stand-alone-circle3': StandAloneCircle3 && hover == 2,
  186. }"
  187. cx="0"
  188. cy="0"
  189. r="30"
  190. fill="none"
  191. stroke="#edbf03"
  192. stroke-width="1"
  193. />
  194. <circle
  195. :class="{
  196. 'stand-alone-circle4': StandAloneCircle4 && hover == 2,
  197. }"
  198. cx="0"
  199. cy="0"
  200. r="45"
  201. fill="none"
  202. stroke="#edbf03"
  203. stroke-width="1"
  204. />
  205. </g>
  206. <g id="stand-alone-circle-fdj">
  207. <circle
  208. :class="{
  209. 'stand-alone-circle1': StandAloneCircle1 && hover == 1,
  210. }"
  211. cx="0"
  212. cy="0"
  213. r="10"
  214. fill="#edbf03"
  215. />
  216. <circle
  217. :class="{
  218. 'stand-alone-circle2': StandAloneCircle2 && hover == 1,
  219. }"
  220. cx="0"
  221. cy="0"
  222. r="20"
  223. fill="none"
  224. stroke="#edbf03"
  225. stroke-width="2"
  226. />
  227. <circle
  228. :class="{
  229. 'stand-alone-circle3': StandAloneCircle3 && hover == 1,
  230. }"
  231. cx="0"
  232. cy="0"
  233. r="30"
  234. fill="none"
  235. stroke="#edbf03"
  236. stroke-width="1"
  237. />
  238. <circle
  239. :class="{
  240. 'stand-alone-circle4': StandAloneCircle4 && hover == 1,
  241. }"
  242. cx="0"
  243. cy="0"
  244. r="45"
  245. fill="none"
  246. stroke="#edbf03"
  247. stroke-width="1"
  248. />
  249. </g>
  250. <g id="stand-alone-circle-ph">
  251. <circle
  252. :class="{
  253. 'stand-alone-circle1': StandAloneCircle1 && hover == 4,
  254. }"
  255. cx="0"
  256. cy="0"
  257. r="10"
  258. fill="#edbf03"
  259. />
  260. <circle
  261. :class="{
  262. 'stand-alone-circle2': StandAloneCircle2 && hover == 4,
  263. }"
  264. cx="0"
  265. cy="0"
  266. r="20"
  267. fill="none"
  268. stroke="#edbf03"
  269. stroke-width="2"
  270. />
  271. <circle
  272. :class="{
  273. 'stand-alone-circle3': StandAloneCircle3 && hover == 4,
  274. }"
  275. cx="0"
  276. cy="0"
  277. r="30"
  278. fill="none"
  279. stroke="#edbf03"
  280. stroke-width="1"
  281. />
  282. <circle
  283. :class="{
  284. 'stand-alone-circle4': StandAloneCircle4 && hover == 4,
  285. }"
  286. cx="0"
  287. cy="0"
  288. r="45"
  289. fill="none"
  290. stroke="#edbf03"
  291. stroke-width="1"
  292. />
  293. </g>
  294. <g id="stand-alone-circle-yy">
  295. <circle
  296. :class="{
  297. 'stand-alone-circle1': StandAloneCircle1 && hover == 5,
  298. }"
  299. cx="0"
  300. cy="0"
  301. r="10"
  302. fill="#edbf03"
  303. />
  304. <circle
  305. :class="{
  306. 'stand-alone-circle2': StandAloneCircle2 && hover == 5,
  307. }"
  308. cx="0"
  309. cy="0"
  310. r="20"
  311. fill="none"
  312. stroke="#edbf03"
  313. stroke-width="2"
  314. />
  315. <circle
  316. :class="{
  317. 'stand-alone-circle3': StandAloneCircle3 && hover == 5,
  318. }"
  319. cx="0"
  320. cy="0"
  321. r="30"
  322. fill="none"
  323. stroke="#edbf03"
  324. stroke-width="1"
  325. />
  326. <circle
  327. :class="{
  328. 'stand-alone-circle4': StandAloneCircle4 && hover == 5,
  329. }"
  330. cx="0"
  331. cy="0"
  332. r="45"
  333. fill="none"
  334. stroke="#edbf03"
  335. stroke-width="1"
  336. />
  337. </g>
  338. </defs>
  339. <!-- 背景图片 -->
  340. <image
  341. :style="`transform: translate(${getTransformPositionX()}px, 0)`"
  342. x="0"
  343. y="90"
  344. height="787"
  345. width="1570"
  346. v-show="$store.state.themeName === 'dark'"
  347. href="./standAloneImg-green.png"
  348. />
  349. <image
  350. :style="`transform: translate(${getTransformPositionX()}px, 0)`"
  351. x="0"
  352. y="90"
  353. height="787"
  354. width="1570"
  355. v-show="$store.state.themeName === 'light'"
  356. href="./standAloneImg-white.png"
  357. />
  358. <!-- 变桨 -->
  359. <g
  360. class="stand-alone-img-g"
  361. :class="{ active: activeIndex == 3 }"
  362. @mouseover="mouseover(3)"
  363. @mouseout="mouseout"
  364. @click="click(3)"
  365. >
  366. <use
  367. :transform="`translate(${getTransformPositionX(100)}, 190) scale(0.7)`"
  368. class="stand-alone-img-item"
  369. xlink:href="#pitch"
  370. x="214"
  371. y="110"
  372. />
  373. <use
  374. class="stand-alone-img-item-circle"
  375. xlink:href="#stand-alone-circle-bj"
  376. :x="getTransformPositionX(320)"
  377. y="330"
  378. />
  379. <line
  380. :class="{ 'stand-alone-line': line && hover == 3 }"
  381. :x1="getTransformPositionX(320)"
  382. y1="330"
  383. :x2="getTransformPositionX(620)"
  384. y2="50"
  385. stroke="#edbf03"
  386. stroke-width="2"
  387. />
  388. <circle
  389. :class="{ 'stand-alone-circle': circle && hover == 3 }"
  390. :cx="getTransformPositionX(620)"
  391. cy="50"
  392. r="5"
  393. fill="#edbf03"
  394. />
  395. <text
  396. :class="{ 'stand-alone-text': text && hover == 3 }"
  397. :x="getTransformPositionX(630)"
  398. y="60"
  399. fill="#fcaf17"
  400. font-size="50"
  401. >
  402. 变桨
  403. </text>
  404. </g>
  405. <!-- 机舱 -->
  406. <g
  407. class="stand-alone-img-g"
  408. :class="{ active: activeIndex == 6 }"
  409. @mouseover="mouseover(6)"
  410. @mouseout="mouseout"
  411. @click="click(6)"
  412. >
  413. <use
  414. :style="`transform: translate(${getTransformPositionX()}px, 0)`"
  415. class="stand-alone-img-item"
  416. xlink:href="#engine-room"
  417. x="1270"
  418. y="395"
  419. />
  420. <use
  421. class="stand-alone-img-item-circle"
  422. xlink:href="#stand-alone-circle-jc"
  423. :x="getTransformPositionX(750)"
  424. y="380"
  425. />
  426. <line
  427. :class="{ 'stand-alone-line': line && hover == 6 }"
  428. :x1="getTransformPositionX(750)"
  429. y1="380"
  430. :x2="getTransformPositionX(1050)"
  431. y2="90"
  432. stroke="#edbf03"
  433. stroke-width="2"
  434. />
  435. <circle
  436. :class="{ 'stand-alone-circle': circle && hover == 6 }"
  437. :cx="getTransformPositionX(1050)"
  438. cy="90"
  439. r="5"
  440. fill="#edbf03"
  441. />
  442. <text
  443. :class="{ 'stand-alone-text': text && hover == 6 }"
  444. :x="getTransformPositionX(1060)"
  445. y="100"
  446. fill="#fcaf17"
  447. font-size="50"
  448. >
  449. 机舱
  450. </text>
  451. </g>
  452. <!-- 齿轮箱 -->
  453. <g
  454. class="stand-alone-img-g"
  455. :class="{ active: activeIndex == 2 }"
  456. @mouseover="mouseover(2)"
  457. @mouseout="mouseout"
  458. @click="click(2)"
  459. >
  460. <use
  461. class="stand-alone-img-item"
  462. xlink:href="#gear-box"
  463. x="730"
  464. y="335"
  465. :transform="`translate(${getTransformPositionX(220)}, 280) scale(0.7)`"
  466. />
  467. <use
  468. class="stand-alone-img-item-circle"
  469. xlink:href="#stand-alone-circle-clx"
  470. :x="getTransformPositionX(800)"
  471. y="550"
  472. />
  473. <line
  474. :class="{ 'stand-alone-line': line && hover == 2 }"
  475. :x1="getTransformPositionX(800)"
  476. y1="550"
  477. :x2="getTransformPositionX(1100)"
  478. y2="250"
  479. stroke="#edbf03"
  480. stroke-width="2"
  481. />
  482. <circle
  483. :class="{ 'stand-alone-circle': circle && hover == 2 }"
  484. :cx="getTransformPositionX(1100)"
  485. cy="250"
  486. r="5"
  487. fill="#edbf03"
  488. />
  489. <text
  490. :class="{ 'stand-alone-text': text && hover == 2 }"
  491. :x="getTransformPositionX(1110)"
  492. y="250"
  493. fill="#fcaf17"
  494. font-size="50"
  495. >
  496. 齿轮箱
  497. </text>
  498. </g>
  499. <!-- 发电机 -->
  500. <g
  501. class="stand-alone-img-g"
  502. :class="{ active: activeIndex == 1 }"
  503. @mouseover="mouseover(1)"
  504. @mouseout="mouseout"
  505. @click="click(1)"
  506. >
  507. <use
  508. class="stand-alone-img-item"
  509. xlink:href="#alternator"
  510. x="900"
  511. y="385"
  512. :transform="`translate(${getTransformPositionX(300)}, 260) scale(0.7)`"
  513. />
  514. <use
  515. class="stand-alone-img-item-circle"
  516. xlink:href="#stand-alone-circle-fdj"
  517. :x="getTransformPositionX(990)"
  518. y="580"
  519. />
  520. <line
  521. :class="{ 'stand-alone-line': line && hover == 1 }"
  522. :x1="getTransformPositionX(990)"
  523. y1="580"
  524. :x2="getTransformPositionX(1290)"
  525. y2="880"
  526. stroke="#edbf03"
  527. stroke-width="2"
  528. />
  529. <circle
  530. :class="{ 'stand-alone-circle': circle && hover == 1 }"
  531. :cx="getTransformPositionX(1290)"
  532. cy="880"
  533. r="5"
  534. fill="#edbf03"
  535. />
  536. <text
  537. :class="{ 'stand-alone-text': text && hover == 1 }"
  538. :x="getTransformPositionX(1300)"
  539. y="920"
  540. fill="#fcaf17"
  541. font-size="50"
  542. >
  543. 发电机
  544. </text>
  545. </g>
  546. <!-- 偏航 -->
  547. <g
  548. class="stand-alone-img-g"
  549. :class="{ active: activeIndex == 4 }"
  550. @mouseover="mouseover(4)"
  551. @mouseout="mouseout"
  552. @click="click(4)"
  553. >
  554. <use
  555. class="stand-alone-img-item"
  556. xlink:href="#yaw"
  557. :x="getTransformPositionX(675)"
  558. y="645"
  559. />
  560. <use
  561. class="stand-alone-img-item-circle"
  562. xlink:href="#stand-alone-circle-ph"
  563. :x="getTransformPositionX(650)"
  564. y="750"
  565. />
  566. <line
  567. :class="{ 'stand-alone-line': line && hover == 4 }"
  568. :x1="getTransformPositionX(650)"
  569. y1="750"
  570. :x2="getTransformPositionX(950)"
  571. y2="1050"
  572. stroke="#edbf03"
  573. stroke-width="2"
  574. />
  575. <circle
  576. :class="{ 'stand-alone-circle': circle && hover == 4 }"
  577. :cx="getTransformPositionX(950)"
  578. cy="1050"
  579. r="5"
  580. fill="#edbf03"
  581. />
  582. <text
  583. :class="{ 'stand-alone-text': text && hover == 4 }"
  584. :x="getTransformPositionX(960)"
  585. y="1050"
  586. fill="#fcaf17"
  587. font-size="50"
  588. >
  589. 偏航
  590. </text>
  591. </g>
  592. <!-- 液压 -->
  593. <g
  594. class="stand-alone-img-g"
  595. :class="{ active: activeIndex == 5 }"
  596. @mouseover="mouseover(5)"
  597. @mouseout="mouseout"
  598. @click="click(5)"
  599. >
  600. <use
  601. class="stand-alone-img-item"
  602. xlink:href="#hydraulic-pressure"
  603. x="775"
  604. y="455"
  605. :transform="`translate(${getTransformPositionX(260)}, 310) scale(0.7)`"
  606. />
  607. <use
  608. class="stand-alone-img-item-circle"
  609. xlink:href="#stand-alone-circle-yy"
  610. :x="getTransformPositionX(850)"
  611. y="730"
  612. />
  613. <line
  614. :class="{ 'stand-alone-line': line && hover == 5 }"
  615. :x1="getTransformPositionX(850)"
  616. y1="730"
  617. :x2="getTransformPositionX(1150)"
  618. y2="1030"
  619. stroke="#edbf03"
  620. stroke-width="2"
  621. />
  622. <circle
  623. :class="{ 'stand-alone-circle': circle && hover == 5 }"
  624. :cx="getTransformPositionX(1150)"
  625. cy="1030"
  626. r="5"
  627. fill="#edbf03"
  628. />
  629. <text
  630. :class="{ 'stand-alone-text': text && hover == 5 }"
  631. :x="getTransformPositionX(1160)"
  632. y="1030"
  633. fill="#fcaf17"
  634. font-size="50"
  635. >
  636. 液压
  637. </text>
  638. </g>
  639. </svg>
  640. </template>
  641. <script>
  642. export default {
  643. // 名称
  644. name: "StandAloneImg",
  645. // 使用组件
  646. components: {},
  647. // 数据
  648. data() {
  649. return {
  650. StandAloneCircle1: false,
  651. StandAloneCircle2: false,
  652. StandAloneCircle3: false,
  653. StandAloneCircle4: false,
  654. line: false,
  655. circle: false,
  656. text: false,
  657. hover: 0,
  658. svgWidth: 0,
  659. svgHeight: 400,
  660. // SVG 整体横向位移值,正数向左位移,负数向右位移,连同内部高亮区域与其他元素会一并位移
  661. transformPositionX: 480,
  662. };
  663. },
  664. props: {
  665. activeIndex: {
  666. type: Number,
  667. default: 0,
  668. },
  669. },
  670. emits: {
  671. // 选中事件
  672. selectSvg: null,
  673. },
  674. // 函数
  675. methods: {
  676. mouseover: function (hIndex) {
  677. this.StandAloneCircle1 = false;
  678. this.StandAloneCircle2 = false;
  679. this.StandAloneCircle3 = false;
  680. this.StandAloneCircle4 = false;
  681. this.line = false;
  682. this.circle = false;
  683. this.text = false;
  684. this.StandAloneCircle1 = true;
  685. this.StandAloneCircle2 = true;
  686. this.StandAloneCircle3 = true;
  687. this.StandAloneCircle4 = true;
  688. this.line = true;
  689. this.circle = true;
  690. this.text = true;
  691. // this.hover = hIndex;
  692. this.hover = this.activeIndex;
  693. },
  694. mouseout: function () {
  695. this.StandAloneCircle1 = false;
  696. this.StandAloneCircle2 = false;
  697. this.StandAloneCircle3 = false;
  698. this.StandAloneCircle4 = false;
  699. this.line = false;
  700. this.circle = false;
  701. this.text = false;
  702. this.hover = 0;
  703. },
  704. click: function (index) {
  705. this.$emit("selectSvg", index);
  706. },
  707. getTransformPositionX(posValue = 0) {
  708. return posValue - this.transformPositionX;
  709. },
  710. },
  711. // 生命周期钩子
  712. beforeCreate() {
  713. // 创建前
  714. },
  715. created() {
  716. // 创建后
  717. },
  718. beforeMount() {
  719. // 渲染前
  720. },
  721. mounted() {
  722. this.svgWidth = document.documentElement.clientWidth * 0.75 - 60 || 1385;
  723. // 渲染后
  724. let isShow = setInterval(() => {
  725. if (this.$el.style.display != "none") {
  726. if (this.$el.scrollWidth == this.svgWidth) {
  727. let height = this.$el.scrollHeight.toFixed(0);
  728. let width = (
  729. (height / (this.svgHeight + 50)) *
  730. this.svgWidth
  731. ).toFixed(0);
  732. this.svgWidth = width;
  733. this.svgHeight = height;
  734. clearInterval(isShow);
  735. } else {
  736. let width = this.$el.scrollWidth.toFixed(0);
  737. let height = ((width / this.svgWidth) * this.svgHeight).toFixed(0);
  738. this.svgWidth = width;
  739. this.svgHeight = height;
  740. clearInterval(isShow);
  741. }
  742. }
  743. }, 200);
  744. },
  745. beforeUpdate() {
  746. // 数据更新前
  747. },
  748. updated() {
  749. // 数据更新后
  750. },
  751. watch: {},
  752. };
  753. </script>
  754. <style lang="less" scoped>
  755. .stand-alone-img {
  756. .stand-alone-img-path {
  757. -webkit-filter: drop-shadow(0 0 5px @green);
  758. }
  759. .stand-alone-img-g {
  760. .stand-alone-img-item {
  761. opacity: 0;
  762. cursor: pointer;
  763. transition: all 0.3s;
  764. }
  765. .stand-alone-img-item-circle,
  766. line,
  767. circle,
  768. text {
  769. opacity: 0;
  770. }
  771. text {
  772. display: none;
  773. }
  774. &:hover,
  775. &.active {
  776. .stand-alone-img-item,
  777. .stand-alone-img-item-circle,
  778. line,
  779. circle,
  780. text {
  781. opacity: 1;
  782. }
  783. text {
  784. display: block;
  785. }
  786. }
  787. }
  788. .stand-alone-circle1 {
  789. animation: StandAloneCircle1 0.1s linear;
  790. }
  791. .stand-alone-circle2 {
  792. animation: StandAloneCircle2 0.2s linear;
  793. }
  794. .stand-alone-circle3 {
  795. animation: StandAloneCircle3 0.3s linear;
  796. }
  797. .stand-alone-circle4 {
  798. animation: StandAloneCircle4 0.45s linear;
  799. }
  800. .stand-alone-line {
  801. stroke-dasharray: 430, 450;
  802. animation: line 0.45s linear;
  803. }
  804. .stand-alone-circle {
  805. animation: circle 0.5s linear;
  806. }
  807. .stand-alone-text {
  808. animation: text 0.5s linear;
  809. }
  810. }
  811. @keyframes line {
  812. from {
  813. stroke-dashoffset: 430;
  814. }
  815. to {
  816. stroke-dashoffset: 0;
  817. }
  818. }
  819. @keyframes circle {
  820. 0% {
  821. r: 0;
  822. }
  823. 90% {
  824. r: 0;
  825. }
  826. 100% {
  827. r: 5;
  828. }
  829. }
  830. @keyframes text {
  831. 0% {
  832. opacity: 0;
  833. }
  834. 90% {
  835. opacity: 0;
  836. }
  837. 100% {
  838. opacity: 1;
  839. }
  840. }
  841. @keyframes StandAloneCircle1 {
  842. from {
  843. r: 0;
  844. }
  845. to {
  846. r: 10;
  847. }
  848. }
  849. @keyframes StandAloneCircle2 {
  850. from {
  851. r: 0;
  852. }
  853. to {
  854. r: 20;
  855. }
  856. }
  857. @keyframes StandAloneCircle3 {
  858. from {
  859. r: 0;
  860. }
  861. to {
  862. r: 30;
  863. }
  864. }
  865. @keyframes StandAloneCircle4 {
  866. from {
  867. r: 0;
  868. }
  869. to {
  870. r: 45;
  871. }
  872. }
  873. </style>