当前位置: 首页 > 工具软件 > Vue-material > 使用案例 >

vue-material-year-calendar使用时css有问题导致的一些打包错误 vue2

司马建柏
2023-12-01
//MonthCalendar.vue
<style lang="less" scoped>
.c-wrapper {
  padding: 10px;
}

.calendar {
  background-color: #fff;
  min-height: 295px;
  text-align: center;
  color: rgba(#353C46, 0.8);
  border-radius: 2px;
  min-width: 0;
  position: relative;
  text-decoration: none;
  box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.3s ease;

  &:hover {
    z-index: 2;

    @media (min-width: 1024px) {
      transform: scale(1.15);
      box-shadow: 0 7px 21px 0 rgba(0, 0, 0, 0.1);
    }
  }

  .calendar__title {
    font-weight: bold;
    flex: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(#C4C4C4, 0.3);
    font-size: 18px;
    height: 50px;
    margin-bottom: 12px;
    cursor: pointer;
  }

  .calendar__body {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-content: flex-start;
    padding: 0px 20px;
    min-width: 194px;
  }

  .calendar__day {
    flex: 14.28%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    height: 31px;
    color: #5DB3D4;
  }

  .day__weektitle {
    color: rgba(#353C46, 0.8);
  }

  .day {
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border-radius: 5px;

    &:after {
      content: '';
      display: block;
      height: 10px;
      width: 10px;
      position: absolute;
      top: -5px;
      right: -5px;
      border-radius: 50%;
      z-index: 1;
      background-color: transparent;
    }

    &.calendar--active:after {
      background-image: url('../assets/baseline-remove_circle-24px.svg');
      background-size: 100% 100%;
    }

    &:not(.calendar__day--otherMonth):hover {
      background-color: rgba(#666, 0.1);
      border-radius: 5px;
    }

    &.calendar--active {
      background-color: rgba(#FFBABA, 0.5);
      color: #BCBCBC;

      &.info {
        background-color: rgba(#17a2b8, 0.8);
        color: #fff;

        &:after {
          background-image: url('../assets/RecordIt.svg');
          background-size: 100% 100%;
        }
      }

      &.warning {
        background-color: rgba(#ffc107, 0.7);
        color: #fff;

        &:after {
          background-image: url('../assets/round-warning-24px.svg');
          background-color: rgba(#eaeaea, 0.3);
          background-size: 100% 100%;
        }
      }
    }
  }

  & .calendar__day--otherMonth {
    color: #eaeaea;
    cursor: auto;
  }
}
</style>
//YearCalendar.vue
<style lang="less" scoped>
.vue-calendar__container {
  border-radius: 2px;
  min-width: 0;
  position: relative;
  text-decoration: none;
  box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
  background-color: #F6F6F3;

  .container__year {
    user-select: none;
    height: 65px;
    background-color: #fff;
    font-size: 24px;
    flex: 100%;
    text-align: center;
    display: flex;

    .year__chooser {
      height: 100%;
      flex: 1;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: rgba(black, 0.9);

      &:hover {
        background-color: rgba(#666, 0.1);
      }

      &:nth-child(4n-3) {
        color: rgba(black, 0.3);
      }

      &:nth-child(2n) {
        color: rgba(black, 0.6);
      }

      &:nth-child(3) {
        box-shadow: inset 0px -3px #4792BD;
      }
    }
  }

  .container__months {
    flex-wrap: wrap;
    display: flex;
    padding: 15px;
  }

  .container__month {
    padding: 8px;
    flex: 16.66%;

    @media (max-width: 1300px) {
      flex: 25%;
    }

    @media (max-width: 992px) {
      flex: 33.3%;
    }

    @media (max-width: 768px) {
      flex: 50%;
    }

    @media (max-width: 450px) {
      flex: 100%;
    }
  }

  .p-0 {
    padding: 0px;
  }
}
</style>
<style lang="less">
.container__months.hide-sunday {
  .calendar__day:nth-of-type(7n) {
    display: none;
  }

  .calendar__day {
    flex: 16.66%;
  }
}

.container__months.hide-weekend {
  .calendar__day:nth-of-type(7n), .calendar__day:nth-of-type(7n-1) {
    display: none;
  }

  .calendar__day {
    flex: 19%;
  }
}
</style>

//app.vue
<style lang="less">
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#app {
  padding: 60px;
  background-color: #eaeaea;
}

.your_customized_wrapper_class {
  background-color: #0aa;
  color: white;

  &.red {
    background-color: #a00;
    color: white;

    &:after {
      background-image: url('./assets/baseline-remove_circle-24px.svg');
      background-size: 100% 100%;
    }
  }

  &.blue {
    background-color: #0000aa;
    color: white;
  }

  &.your_customized_classname {
    background-color: yellow;
    color: black;
  }
}
</style>

node包里面的样式问题

 类似资料: