收藏
回答

请教wxss cannot read property "length" of undefined?

1.开发工具最新版

2.原有项目,能够正常运行

3.但是忽然发现,预览和真机调试时,会出现wxss cannot read property "length" of undefined,导致不能预览和真机调试

4.疑问:wxss样式中怎么会有length

5.以下为截图


回答关注问题邀请回答
收藏

1 个回答

  • 睡前原谅一切
    睡前原谅一切
    2020-05-06

    cuotiku的 wxss多么。多的话 全部放出来,少的话 截个图看下。

    2020-05-06
    有用 2
    回复 5
    • 杜
      2020-05-06
      /**index.wxss**/
      page {
        background: linear-gradient(to bottom, #010132, #091b6a);
        height: 100%;
        overflow: hidden;
      }
      /* 定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
      ::-webkit-scrollbar {
        width: 6px;
        height: 3px;
        background-color: rgb(16, 32, 122, 0.3);
      }
      /* 定义滚动条轨道 内阴影+圆角 */
      ::-webkit-scrollbar-track {
        -webkit-box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
        background-color: white;
      }
      /* 定义滑块 内阴影+圆角 */
      ::-webkit-scrollbar-thumb {
        border-radius: 10px;
        -webkit-box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
        background-color: rgb(82, 79, 79);
      }
      .cont {
        height: 100%;
        width: 100%;
        background-size: 100%;
        background-position: 0 47%;
        background-repeat: no-repeat;
      }
      .touxiang {
        margin-top: 40rpx;
        width: 100%;
        display: flex;
        justify-content: space-between;
      }
      .touxiang1 {
        width: 196rpx;
        height: 122rpx;
        background-repeat: no-repeat;
        background-size: 100% 100%;
      }
      .avatar {
        width: 120rpx;
        height: 120rpx;
        border-radius: 50%;
        position: absolute;
        margin-left: 76rpx;
      }
      #userName {
        font-size: 30rpx;
        color: #fff;
        font-family: "Microsoft YaHei";
        margin-right: 230rpx;
        padding-top: 40rpx;
      }
      .time {
        font-size: 24rpx;
        color: #fff;
        font-family: "Microsoft YaHei";
        margin-top: 40rpx;
      }
      .str {
        margin-left: 10rpx;
        margin-right: 5rpx;
        font-size: 36rpx;
        background-repeat: no-repeat;
        background-size: 100% 100%;
      }
      .datika {
        width: 196rpx;
        height: 122rpx;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        font-size: 36rpx;
        color: #fff;
        font-family: "Microsoft YaHei";
        font-weight: 700;
        text-align: center;
        line-height: 122rpx;
      }
      .body {
        text-align: center;
        margin: 0 auto;
        margin-top: 60rpx;
        height: 50%;
        width: 640rpx;
        border-radius: 10px;
        background: no-repeat center center;
      }
      .pagenum {
        padding-top: 20rpx;
        margin-bottom: 20rpx;
        font-size: 26rpx;
        font-family: "Microsoft YaHei";
        color: #ccc;
      }
      .cuowucishu {
        font-size: 26rpx;
        font-family: "Microsoft YaHei";
        color: #e97d8d;
        float: right;
        margin-right: 35rpx;
        margin-top: -35rpx;
      }
      .pagetitle {
        font-weight: 700;
        font-size: 32rpx;
        font-family: "Microsoft YaHei";
        color: #333;
        text-align: left;
        padding-left: 15rpx;
      }
      .isAsr {
        font-weight: 700;
        font-size: 28rpx;
        font-family: "Microsoft YaHei";
        color: #333;
        text-align: center;
        margin: auto auto;
        margin-top: 30rpx;
      }
      .line {
        margin-top: 30rpx;
        height: 1rpx;
        background-color: #e1e1e1;
      }
      .pagecont {
        margin: 15rpx auto;
        height: auto;
        width: 520rpx;
        background: #f2f1f6;
        border-radius: 10rpx;
        font-size: 30rpx;
        font-family: "Microsoft YaHei";
        color: #666;
        padding: 15rpx;
        text-align: left;
      }
      .pagecont_error {
        margin: 15rpx auto;
        height: 80rpx;
        width: 520rpx;
        background: linear-gradient(to margin-right, #f0c49f, #e97d8d);
        border-radius: 90rpx;
        font-size: 30rpx;
        font-family: "Microsoft YaHei";
        color: #fff;
        line-height: 80rpx;
        text-align: left;
      }
      .pagecont_right {
        background: linear-gradient(to margin-right, #59a5f0, #3b6fe9);
        color: #fff;
        text-align: left;
        margin: 15rpx auto;
        height: auto;
        width: 520rpx;
        border-radius: 10rpx;
        font-size: 30rpx;
        font-family: "Microsoft YaHei";
        padding: 15rpx;
      }
      .next {
        font-weight: 700;
        font-size: 32rpx;
        font-family: "Microsoft YaHei";
        color: #fff;
        display: flex;
        justify-content: space-between;
        margin: 20rpx 65rpx;
      }
      .next_check {
        color: yellow;
      }
      /* 遮罩层 */
      .mask {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        background: #000;
        z-index: 9000;
        opacity: 0.5;
      }
      /*答题卡弹出层 */
      .modalDlg1 {
        width: 100%;
        height: 82%;
        top: 150px;
        position: fixed;
        z-index: 9999;
        background-color: white;
      }
      /* 弹出层里面的图片 */
      .close {
        height: 50rpx;
        width: 50rpx;
        float: right;
        margin-right: 40rpx;
        margin-top: 20rpx;
      }
      /* 弹出层里面的文字 */
      .one {
        display: flex;
        flex-wrap: wrap;
        width: 94%;
        padding-bottom: 50rpx;
      }
      .onetext {
        height: 90rpx;
        width: 90rpx;
        margin-top: 30rpx;
        margin-left: 40rpx;
        font-size: 36rpx;
        color: #999;
        background-size: 100%;
        background-repeat: no-repeat;
        text-align: center;
        line-height: 90rpx;
      }
      2020-05-06
      回复
    • 睡前原谅一切
      睡前原谅一切
      2020-05-06回复
      background: linear-gradient(to right, #f0c49f, #e97d8d);
      把 margin去掉。
      2020-05-06
      回复
    • 睡前原谅一切
      睡前原谅一切
      2020-05-06回复
      这两个地方把margin去掉
      2020-05-06
      回复
    • 杜
      2020-05-06
      膜拜 大神 果然可以了 么么哒
      2020-05-06
      回复
    • 睡前原谅一切
      睡前原谅一切
      2020-05-06回复
      = =头大。。
      2020-05-06
      回复
登录 后发表内容
问题标签