VUE:整屏滚动效果


这里需要用的是vue-fullpage插件

安装

npm install vue-fullpage --save
npm install animate.css --save

配置

在main.js需要引入该插件的css和js文件

import 'vue-fullpage/vue-fullpage.css'
import VueFullpage from 'vue-fullpage'
Vue.use(VueFullpage)

页面代码

在page-wp容器上加v-fullpage指令,v-fullpage的值是fullpage的配置 在page容器上加v-animate指令,v-animate的值是animate.css的动画效果

<template>
  <div id="app">
    <div class="fullpage-container">
      <div class="fullpage-wp" v-fullpage="opts">
        <div class="page-1 page">
          <p class="part-1" v-animate="{value: 'bounceInLeft'}">vue-fullpage</p>
        </div>
        <div class="page-2 page">
          <p class="part-2" v-animate="{value: 'bounceInRight'}">vue-fullpage</p>
        </div>
        <div class="page-3 page">
          <p class="part-3" v-animate="{value: 'bounceInLeft', delay: 0}">vue-fullpage</p>
          <p class="part-3" v-animate="{value: 'bounceInRight', delay: 600}">vue-fullpage</p>
          <p class="part-3" v-animate="{value: 'zoomInDown', delay: 1200}">vue-fullpage</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  name: 'App',
  data () {
    return {
      opts: {
        start: 0,
        dir: 'v',
        loop: false,
        duration: 500,
        stopPageScroll: true,
        beforeChange: function (prev, next) {
          console.log(prev,next)
        },
        afterChange: function (prev, next) {
          console.log(prev,next)
        }
      }
    }
  }
}
</script>

<style>
*{
  margin: 0;
  padding: 0;
}
#app{
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  color:red;
}
.page-1{
  background: rgba(0,0,0,0.8);
}
.page-2{
  background: pink;
}
.page-3{
  background: blueviolet;
}
.page-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}
</style>

CSS | 将彩色图片转换成黑白色


需求

净月投资热力图PC端涉及个列表图片,鼠标放上去之后图片变成有颜色的那种。
那就先要让它变成黑白的

代码如下

<img src="..." class="graypic" />
.graypic { 
    -webkit-filter: grayscale(100%);
    -moz-filter: grayscale(100%);
    -ms-filter: grayscale(100%);
    -o-filter: grayscale(100%);
    filter: grayscale(100%);
    filter: gray;
}

示例

background.jpg


element-ui table列合并--支持多个列(vue)


驻场的最后一天,小伙伴列的合并碰到了问题,帮忙解决一下。

效果如图:
微信截图_20201219105321.png

具体代码:

<el-table
        :data="tableData"
        :span-method="arraySpanMethod"
        border
        style="width: 100%; margin-top: 20px">
        <el-table-column
          prop="id"
          label="ID"
          width="180">
        </el-table-column>
        <el-table-column
          prop="name"
          label="姓名">
        </el-table-column>
        <el-table-column
          prop="amount1"
          label="数值 1(元)">
        </el-table-column>
        <el-table-column
          prop="amount2"
          label="数值 2(元)">
        </el-table-column>
        <el-table-column
          prop="amount3"
          label="数值 3(元)">
        </el-table-column>
      </el-table>

js部分

export default {
    data(){
        return {
          // 模拟后台返回数据
          tableData: [{
              id: '12987122',
              name: '王小虎',
              amount1: '234',
              amount2: '3.2',
              amount3: 10
            }, {
              id: '12987123',
              name: '王小虎',
              amount1: '165',
              amount2: '4.43',
              amount3: 12
            }, {
              id: '12987124',
              name: '王小虎',
              amount1: '324',
              amount2: '1.9',
              amount3: 9
            }, {
              id: '12987125',
              name: '王小虎',
              amount1: '621',
              amount2: '2.2',
              amount3: 17
            }, {
              id: '12987126',
              name: '王小虎',
              amount1: '539',
              amount2: '4.1',
              amount3: 15
            }, {
              id: '12987126',
              name: '王小虎3',
              amount1: '539',
              amount2: '4.1',
              amount3: 15
            }, {
              id: '12987126',
              name: '王小虎2',
              amount1: '539',
              amount2: '4.1',
              amount3: 15
            }, {
              id: '12987126',
              name: '王小虎2',
              amount1: '539',
              amount2: '4.1',
              amount3: 15
            }],
        needMergeArr: ['name', 'id'], // 有合并项的列
         rowMergeArrs: {}, // 包含需要一个或多个合并项信息的对象
        };
    },
    methods:{
            /**
             * @description 实现合并行或列
             * @param row:Object 需要合并的列name 如:'name' 'id'
             * @param column:Object 当前行的行数,由合并函数传入
             * @param rowIndex:Number 当前列的数据,由合并函数传入
             * @param columnIndex:Number 当前列的数据,由合并函数传入
             *
             * @return 函数可以返回一个包含两个元素的数组,第一个元素代表rowspan,第二个元素代表colspan。 也可以返回一个键名为rowspan和colspan的对象
             * 参考地址:https://element.eleme.cn/#/zh-CN/component/table#table-biao-ge
            */
            arraySpanMethod({ row, column, rowIndex, columnIndex }) {
                // 没办法循环判断具体是那一列 所以就只好写了多个if
                if (column.property === 'name') return this.mergeAction('name', rowIndex, column);
                if (column.property === 'id') return this.mergeAction('id', rowIndex, column);
            },
            /**
             * @description 根据数组来确定单元格是否需要合并
             * @param val:String 需要合并的列name 如:'name' 'id'
             * @param rowIndex:Number 当前行的行数,由合并函数传入
             * @param colData:Object 当前列的数据,由合并函数传入
             *
             * @return 返回值为一个数组表示该单元格是否需要合并; 说明: [0,0]表示改行被合并了 [n+,1]n为1时表示该单元格不动,n大于1时表示合并了N-1个单元格
            */
            mergeAction(val, rowIndex, colData) {
                let _row = this.rowMergeArrs[val].rowArr[rowIndex];
                let _col = _row > 0 ? 1 : 0;
                return [_row, _col];
            },
            /**
             * @description 根据数组将指定对象转化为相应的数组
             * @param arr:Array[String] 必填 必须是字符串形式的数组
             * @param data:Array 必填 需要转化的对象
             *
             * @return 返回一个对象
             * 例:rowMerge(['name','value'], [{value:'1', name:'小明'}, {value:'2', name:'小明'}, {value:'3', name:'小明'}, {value:'1', name:'小明'}, {value:'1', name:'小明'}])
             * 返回值: {
             *          name:{
             *            rowArr: [5, 0, 0, 0, 0]
             *            rowMergeNum: 0,
             *          },
             *          value: {
             *            rowArr: [1, 1, 1, 2, 0],
             *            rowMergeNum: 3
             *          }
             *        }
            */
            rowMergeHandle(arr, data) {
              if (!Array.isArray(arr) && !arr.length) return false;
              if (!Array.isArray(data) && !data.length) return false;
              let needMerge = {};
              arr.forEach(i => {
                needMerge[i] = {
                  rowArr: [],
                  rowMergeNum: 0
                };
                data.forEach((item, index) => {
                  if (index === 0) {
                    needMerge[i].rowArr.push(1);
                    needMerge[i].rowMergeNum = 0;
                  } else {
                    if (item[i] === data[index - 1][i]) {
                      needMerge[i].rowArr[needMerge[i].rowMergeNum] += 1;
                      needMerge[i].rowArr.push(0);
                    } else {
                      needMerge[i].rowArr.push(1);
                      needMerge[i].rowMergeNum = index;
                    }
                  }
                });
              });
              return needMerge;
            }
          }
    },
    mounted(){
        this.rowMergeArrs = this.rowMergeHandle(this.needMergeArr, this.tableData); // 处理数据
    }
}

CSS:鼠标悬停整体上升


驻场管委会需要个悬停的效果:

.mouse_onshow{background:white;margin:0 5px;}
.mouse_onshow:hover{
    transform:translate(0,-10px);  
   -webkit-transform:translate(0,-10px);    
  -moz-transform:translate(0,-10px);    
  -o-transform:translate(0,-10px);    
  -ms-transform:translate(0,-10px);
    box-shadow:0px 5px 20px #ccc;
}

1.鼠标悬停图片变大

:hover {

  -webkit-transform: scale(1.1);

  -moz-transform: scale(1.1);

  -o-transform: scale(1.1);

  -ms-transform: scale(1.1);

}

缓慢变化需要在包住图片的外层加上:-webkit-transition: all 0.5s; -moz-transition: all 0.5s; -o-transition: all 0.5s; -ms-transition: all 0.5s;

变大不超出的话就加上overflow:hidden;

2.鼠标悬停整体旋转

:hover {

  transform:rotate(360deg);

  -webkit-transform:rotate(360deg);

  -moz-transform:rotate(360deg);

  -o-transform:rotate(360deg);

  -ms-transform:rotate(360deg);

}

缓慢变化需要在包住图片的外层加上:transition:All 0.4s ease-in-out;-webkit-transition:All 0.4s ease-in-out;-moz-transition:All 0.4s ease-in-out;-o-transition:All 0.4s ease-in-out;

3.鼠标悬停整体旋转放大

:hover {

  transform:rotate(360deg) scale(1.2);

  -webkit-transform:rotate(360deg) scale(1.2);

  -moz-transform:rotate(360deg) scale(1.2);

  -o-transform:rotate(360deg) scale(1.2);

  -ms-transform:rotate(360deg) scale(1.2);

}

缓慢变化需要在包住图片的外层加上:transition:All 0.4s ease-in-out;-webkit-transition:All 0.4s ease-in-out;-moz-transition:All 0.4s ease-in-out;-o-transition:All 0.4s ease-in-out;

4.鼠标悬停整体上升

:hover {

  transform:translate(0,-10px);

  -webkit-transform:translate(0,-10px);

  -moz-transform:translate(0,-10px);

  -o-transform:translate(0,-10px);

  -ms-transform:translate(0,-10px);

}

缓慢变化需要在包住图片的外层加上:transition:All 0.4s ease-in-out;-webkit-transition:All 0.4s ease-in-out;-moz-transition:All 0.4s ease-in-out;-o-transition:All 0.4s ease-in-out;

需要上升载加一点阴影(加在hover里面):box-shadow:0px 5px 20px #ccc;


CSS:画圆点连线


这回再高新管委会驻场,需要到一个效果,没办法,只能手写 ,来吧!
微信图片编辑_20201216083415.jpg

先来个网上的示例,这个是个动画效果

<!DOCTYPE html>
<html>
    <head>
        <style>
            html,
            body {
                width: 100%;
                height: 100%;
            }
            body {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
            }
            .day-05 {
                background: #01161e;
                height: 100%;
                width: 100%;
                display: flex;
                align-items: center;
            }
            .day-05 .container {
                width: 500px;
                height: 500px;
                margin: auto;
                position: relative;
            }
            .day-05 .container .geom {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                opacity: 0;
            }
            .day-05 .container .geom:nth-child(1) {
                transform: rotate(25deg);
                animation: rotateScale2 6s 1s ease-in-out infinite alternate, appear 6s 1s ease-in-out forwards;
            }
            @keyframes rotateScale1 {
                0% {
                    transform: rotate(20deg);
                }
                50% {
                    transform: rotate(-160deg) scale(0.1);
                }
                100% {
                    transform: rotate(-340deg) scale(1);
                }
            }
            .day-05 .container .geom:nth-child(2) {
                transform: rotate(50deg);
                animation: rotateScale2 3s 0.6s ease-in-out infinite alternate, appear 3s 0.6s ease-in-out forwards;
            }
            @keyframes rotateScale2 {
                0% {
                    transform: rotate(40deg);
                }
                50% {
                    transform: rotate(220deg) scale(0.1);
                }
                100% {
                    transform: rotate(400deg) scale(1);
                }
            }
            .day-05 .container .geom:nth-child(3) {
                transform: rotate(75deg);
                animation: rotateScale2 6s 3s ease-in-out infinite alternate, appear 6s 3s ease-in-out forwards;
            }
            @keyframes rotateScale3 {
                0% {
                    transform: rotate(60deg);
                }
                50% {
                    transform: rotate(-120deg) scale(0.1);
                }
                100% {
                    transform: rotate(-300deg) scale(1);
                }
            }
            .day-05 .container .geom:nth-child(4) {
                transform: rotate(100deg);
                animation: rotateScale4 3s 1.2s ease-in-out infinite alternate, appear 3s 1.2s ease-in-out forwards;
            }
            @keyframes rotateScale4 {
                0% {
                    transform: rotate(80deg);
                }
                50% {
                    transform: rotate(260deg) scale(0.1);
                }
                100% {
                    transform: rotate(440deg) scale(1);
                }
            }
            .day-05 .container .geom:nth-child(5) {
                transform: rotate(125deg);
                animation: rotateScale2 6s 5s ease-in-out infinite alternate, appear 6s 5s ease-in-out forwards;
            }
            @keyframes rotateScale5 {
                0% {
                    transform: rotate(100deg);
                }
                50% {
                    transform: rotate(-80deg) scale(0.1);
                }
                100% {
                    transform: rotate(-260deg) scale(1);
                }
            }
            .day-05 .container .geom:nth-child(6) {
                transform: rotate(150deg);
                animation: rotateScale6 3s 1.8s ease-in-out infinite alternate, appear 3s 1.8s ease-in-out forwards;
            }
            @keyframes rotateScale6 {
                0% {
                    transform: rotate(120deg);
                }
                50% {
                    transform: rotate(300deg) scale(0.1);
                }
                100% {
                    transform: rotate(480deg) scale(1);
                }
            }
            .day-05 .container .geom:nth-child(7) {
                transform: rotate(175deg);
                animation: rotateScale2 6s 7s ease-in-out infinite alternate, appear 6s 7s ease-in-out forwards;
            }
            @keyframes rotateScale7 {
                0% {
                    transform: rotate(140deg);
                }
                50% {
                    transform: rotate(-40deg) scale(0.1);
                }
                100% {
                    transform: rotate(-220deg) scale(1);
                }
            }
            .day-05 .container .geom:nth-child(8) {
                transform: rotate(200deg);
                animation: rotateScale8 3s 2.4s ease-in-out infinite alternate, appear 3s 2.4s ease-in-out forwards;
            }
            @keyframes rotateScale8 {
                0% {
                    transform: rotate(160deg);
                }
                50% {
                    transform: rotate(340deg) scale(0.1);
                }
                100% {
                    transform: rotate(520deg) scale(1);
                }
            }
            .day-05 .container .geom:nth-child(odd) .vertice {
                background: #0fe5b0;
            }
            .day-05 .container .geom:nth-child(odd) .vertice::before,
            .day-05 .container .geom:nth-child(odd) .vertice::after {
                background: #0fe5b0;
            }
            .day-05 .container .geom:nth-child(even) .vertice {
                background: #fff;
            }
            .day-05 .container .geom:nth-child(even) .vertice::before,
            .day-05 .container .geom:nth-child(even) .vertice::after {
                background: #fff;
            }
            .day-05 .container .geom .vertice {
                position: absolute;
            }
            .day-05 .container .geom .vertice::before,
            .day-05 .container .geom .vertice::after {
                content: "";
                position: absolute;
            }
            .day-05 .container .geom .vertice-1,
            .day-05 .container .geom .vertice-5 {
                height: 2px;
                left: 166px;
                width: 166px;
            }
            .day-05 .container .geom .vertice-1::before,
            .day-05 .container .geom .vertice-5::before {
                left: -9px;
                top: -9px;
                width: 20px;
                height: 20px;
                border-radius: 100%;
            }
            .day-05 .container .geom .vertice-1::after,
            .day-05 .container .geom .vertice-5::after {
                right: -9px;
                top: -9px;
                width: 20px;
                height: 20px;
                border-radius: 100%;
            }
            .day-05 .container .geom .vertice-5 {
                bottom: 0;
            }
            .day-05 .container .geom .vertice-6,
            .day-05 .container .geom .vertice-7,
            .day-05 .container .geom .vertice-8 {
                width: 2px;
                left: 0;
                height: 234px;
            }
            .day-05 .container .geom .vertice-6 {
                transform: rotate(-45deg);
                top: 334px;
            }
            .day-05 .container .geom .vertice-8 {
                transform: rotate(-135deg);
                top: 166px;
            }
            .day-05 .container .geom .vertice-2 {
                transform: rotate(135deg);
                top: 166px;
            }
            .day-05 .container .geom .vertice-4 {
                transform: rotate(45deg);
                top: 334px;
            }
            .day-05 .container .geom .vertice-2,
            .day-05 .container .geom .vertice-3,
            .day-05 .container .geom .vertice-4 {
                width: 2px;
                right: 0;
                height: 234px;
            }
            .day-05 .container .geom .vertice-3,
            .day-05 .container .geom .vertice-7 {
                height: 166px;
                top: 166px;
            }
            .day-05 .container .geom .vertice-3::before,
            .day-05 .container .geom .vertice-7::before {
                left: -9px;
                top: -9px;
                width: 20px;
                height: 20px;
                border-radius: 100%;
            }
            .day-05 .container .geom .vertice-3::after,
            .day-05 .container .geom .vertice-7::after {
                left: -9px;
                bottom: -9px;
                width: 20px;
                height: 20px;
                border-radius: 100%;
            }
            .day-05 .container .geom .vertice-6,
            .day-05 .container .geom .vertice-8,
            .day-05 .container .geom .vertice-2,
            .day-05 .container .geom .vertice-4 {
                transform-origin: 0 0;
            }
            @keyframes appear {
                0% {
                    opacity: 0;
                }
                100% {
                    opacity: 1;
                }
            }
            @keyframes heightSpan {
                0% {
                    opacity: 0;
                }
                100% {
                    opacity: 1;
                }
            }
        </style>
    </head>
    <body>
        <div class="day-05">
            <div class="container">
                <div class="geom">
                    <span class="vertice vertice-1"></span>
                    <span class="vertice vertice-2"></span>
                    <span class="vertice vertice-3"></span>
                    <span class="vertice vertice-4"></span>
                    <span class="vertice vertice-5"></span>
                    <span class="vertice vertice-6"></span>
                    <span class="vertice vertice-7"></span>
                    <span class="vertice vertice-8"></span>
                </div>
                <div class="geom">
                    <span class="vertice vertice-1"></span>
                    <span class="vertice vertice-2"></span>
                    <span class="vertice vertice-3"></span>
                    <span class="vertice vertice-4"></span>
                    <span class="vertice vertice-5"></span>
                    <span class="vertice vertice-6"></span>
                    <span class="vertice vertice-7"></span>
                    <span class="vertice vertice-8"></span>
                </div>
                <div class="geom">
                    <span class="vertice vertice-1"></span>
                    <span class="vertice vertice-2"></span>
                    <span class="vertice vertice-3"></span>
                    <span class="vertice vertice-4"></span>
                    <span class="vertice vertice-5"></span>
                    <span class="vertice vertice-6"></span>
                    <span class="vertice vertice-7"></span>
                    <span class="vertice vertice-8"></span>
                </div>
                <div class="geom">
                    <span class="vertice vertice-1"></span>
                    <span class="vertice vertice-2"></span>
                    <span class="vertice vertice-3"></span>
                    <span class="vertice vertice-4"></span>
                    <span class="vertice vertice-5"></span>
                    <span class="vertice vertice-6"></span>
                    <span class="vertice vertice-7"></span>
                    <span class="vertice vertice-8"></span>
                </div>
                <div class="geom">
                    <span class="vertice vertice-1"></span>
                    <span class="vertice vertice-2"></span>
                    <span class="vertice vertice-3"></span>
                    <span class="vertice vertice-4"></span>
                    <span class="vertice vertice-5"></span>
                    <span class="vertice vertice-6"></span>
                    <span class="vertice vertice-7"></span>
                    <span class="vertice vertice-8"></span>
                </div>
                <div class="geom">
                    <span class="vertice vertice-1"></span>
                    <span class="vertice vertice-2"></span>
                    <span class="vertice vertice-3"></span>
                    <span class="vertice vertice-4"></span>
                    <span class="vertice vertice-5"></span>
                    <span class="vertice vertice-6"></span>
                    <span class="vertice vertice-7"></span>
                    <span class="vertice vertice-8"></span>
                </div>
                <div class="geom">
                    <span class="vertice vertice-1"></span>
                    <span class="vertice vertice-2"></span>
                    <span class="vertice vertice-3"></span>
                    <span class="vertice vertice-4"></span>
                    <span class="vertice vertice-5"></span>
                    <span class="vertice vertice-6"></span>
                    <span class="vertice vertice-7"></span>
                    <span class="vertice vertice-8"></span>
                </div>
                <div class="geom">
                    <span class="vertice vertice-1"></span>
                    <span class="vertice vertice-2"></span>
                    <span class="vertice vertice-3"></span>
                    <span class="vertice vertice-4"></span>
                    <span class="vertice vertice-5"></span>
                    <span class="vertice vertice-6"></span>
                    <span class="vertice vertice-7"></span>
                    <span class="vertice vertice-8"></span>
                </div>
            </div>
        </div>
    </body>
</html>