问题描述

错误

Do not use empty rulesetscss(emptyRules) css(emptyRules)

源码

<style scoped>
.app-main {
  /*50 = navbar  */
  min-height: calc(100vh - 50px);
  width: 100%;
  position: relative;
  overflow: hidden;
}
.fixed-header+.app-main {
  padding-top: 50px;
}
.hasTagsView+ {
  .app-main {
    /* 84 = navbar + tags-view = 50 + 34 */
     min-height: calc(1000vh - 84px);
    /* min-height: calc(100vh - 84px);*/
  }

  .fixed-header+.app-main {
    padding-top: 84px;
  }
}
</style>

 

解决方案

scoped前面指定一下使用语言,默认语言不支持嵌套的样式设定规则。

<style lang="scss" scoped>
.app-main {
  /*50 = navbar  */
  min-height: calc(100vh - 50px);
  width: 100%;
  position: relative;
  overflow: hidden;
}
.fixed-header+.app-main {
  padding-top: 50px;
}
.hasTagsView+ {
  .app-main {
    /* 84 = navbar + tags-view = 50 + 34 */
     min-height: calc(1000vh - 84px);
    /* min-height: calc(100vh - 84px);*/
  }

  .fixed-header+.app-main {
    padding-top: 84px;
  }
}
</style>

 

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐