搭建页面结构

1、修改 main.js
// /main.js
import Vue from 'vue'
import App from './App.vue'

import './assets/css/reset.css'
import './assets/css/common.css'

import zoom from './assets/scripts/tool/zoom'
zoom()
window.addEventListener('resize', zoom)

Vue.config.productionTip = false

new Vue({
  render: h => h(App),
}).$mount('#app')
2、添加基本样式
/* /src/assets/css/reset.css */
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}

body {
  line-height: 1;
}

li,
ol,
ul {
  list-style: none;
}

blockquote,
q {
  quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

a{
  text-decoration: none;
}
/* /src/assets/css/common.css */
body {
  display: flex;
  transform-origin: 0px 0px 0px;
  overflow: hidden;
  position: relative;
  font-family: "微软雅黑";
}

.text-white-shadow {
  text-shadow: 0 0 5px #fbfbfb, 0 0 10px #fbfbfb, 0 0 20px #228DFF, 0 0 35px #228DFF, 0 0 75px #228DFF;
}

.text-green-shadow {
  text-shadow: 0 0 5px #68fff3, 0 0 10px #68fff3, 0 0 20px #228DFF, 0 0 35px #228DFF, 0 0 75px #228DFF;
}

.chart-title {
  font-size: 52px;
  color: #fff;
  position: absolute;
  top: 10px;
  left: 50px;
}

.auto-tooltip {
  box-sizing: border-box;
  position: absolute;
  padding: 10px 15px;
  background: rgba(59, 57, 54, 0.8);
  border-radius: 5px;
  border: 1px solid #928a82;
  color: #fff;
  font-size: 30px;
  z-index: 9999;
  white-space: nowrap;
  display: none;
}

.axis path,
.axis line {
  fill: none;
  stroke: none;
  shape-rendering: optimizeSpeed;
}

.axis text {
  font-size: 28px;
  font-family: sans-serif;
  fill: #a4d5ff;
}

.legend-hide {
  color: #8da5e4 !important;
}

.map-chart .xingzheng {
  transform: translate(0px, 8px);
}

.map-chart .xingshi .circleMain {
  fill: #0084ff;
}

.map-chart .xingzheng .circleMain {
  fill: #fff;
}

.map-chart .xingshi .circleOuter1,
.xingshi .circleOuter2 {
  stroke: #0084ff;
  fill: none;
}

.map-chart .xingzheng .circleOuter1,
.xingzheng .circleOuter2 {
  stroke: #fff;
  fill: none;
}

.circleOuter2 {
  animation: cri 1s infinite;
}

@keyframes cri {
  0%,
  100%,
  20%,
  40%,
  60%,
  80% {
    -webkit-transition-timing-function: cubic-bezier(0.215, .61, .355, 1);
    transition-timing-function: cubic-bezier(0.215, .61, .355, 1)
  }
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@-webkit-keyframes cri {
  0%,
  100%,
  20%,
  40%,
  60%,
  80% {
    -webkit-transition-timing-function: cubic-bezier(0.215, .61, .355, 1);
    transition-timing-function: cubic-bezier(0.215, .61, .355, 1)
  }
  0% {
    -webkit-transform: scale(1);
  }
  100% {
    -webkit-transform: scale(1.5);
    -webkit-opacity: 0;
  }
}

/* 添加页面背景图 */
.side-r-wrap {
  flex: 1;
  height: 100%;
  background: url(../../assets/images/common/page-bg.jpg) no-repeat;
  background-size: 100% 100%;
  position: relative;
  overflow: hidden;
}
3、实现页面自动缩放
// /main.js
import zoom from './assets/scripts/tool/zoom'
zoom()
window.addEventListener('resize', zoom)
// /src/assets/scripts/tool/zoom.js
import config from './config'

export default () => {
  const {
    pageWidth,
    pageHeight
  } = config

  const body = document.querySelector('body')

  body.style.width = `${pageWidth}px`
  body.style.height = `${pageHeight}px`
  const x = window.innerWidth / pageWidth
  const y = window.innerHeight / pageHeight
  body.style.transform = `scale(${x}, ${y})`
}
// /src/assets/scripts/tool/config.js
export default {
  pageWidth: 3360,
  pageHeight: 1890
}

results matching ""

    No results matching ""