为什么我会收到此错误:NoSuchMethodError:未找到方法:'write$1' on null

问题描述 投票:0回答:0

我正在关注一个 scss turtorial,在向我的 ScSS 添加函数时突然遇到这个错误。似乎没有语法错误,甚至 chatGPT 也认为它是正确的。

@function col-width($columns: 12, $page-width: 100%, $gap: 0.1%) {
  @debug "col-width function arguments: columns = #{$columns}, page-width = #{$page-width}, gap = #{$gap}";
  @return ($page-width - $gap*($columns - 1)) / $columns;
}

$body-background: #fff;
$header-footer-background: rgb(75, 15, 60);
$text-head-foot-color: #fff;
$text-color: black;

// === SIZES ===
$header-height: 50px;
$footer-height: 50px;

@mixin container {
  width: 1200px;
  margin: 0 auto;
}

@mixin header-footer-style {
background: $header-footer-background;
color: $text-head-foot-color;
text-align: center;
}

@mixin theme-box {
width: 6 * col-width();
}
 
 
body {
    background-color: $body-background;
    @include container;
}

header {
  height: $header-height;
  @include header-footer-style;


  h1 {
      margin-top: 0;
      line-height: $header-height;
  }
}
.about-us {


  h2, p {
      color: $text-color;
  }
}
 
.theme {
    @include theme-box;
    display: inline-block;
}


footer {
  height: $footer-height;
  @include header-footer-style;
  
  p {
      line-height: $footer-height;
  }
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Page Title</title>
</head>
<body>
    <header>
            <h1>David´s Design</h1>
    </header>


    <main>
            <section class="about-us">
                    <h2>O společnosti David´s Design</h2>
                    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatum, non porro! Laudantium accusantium eos cupiditate voluptas ullam. Illum, ut, ipsum iste sapiente tenetur blanditiis deleniti doloribus, reprehenderit voluptatibus corrupti officia.
                    Aperiam in officia reiciendis fugiat! Vel laudantium quo accusamus! Nesciunt, ratione molestiae. Qui debitis optio consequatur at dolor necessitatibus amet reprehenderit sunt delectus, placeat ex beatae praesentium iusto nulla quia?
                    Velit in rerum nisi recusandae deleniti, nihil nemo veniam, aut mollitia facere quod omnis voluptates consequuntur nesciunt sed ipsam labore accusantium maxime, repudiandae reprehenderit dolor perferendis animi. Rerum, numquam impedit</p>
            </section>
            <section class="references">
                    <div class="reference-row">
                            <div class="theme first-theme">
                                    <img src="img/theme1.png" alt="">
                                    <a href="#">Zjistit více</a>
                            </div>
                            <div class="theme second-theme">
                                    <img src="img/theme2.png" alt="">
                                    <a href="#">Zjistit více</a>
                            </div>
                    </div>
                    
                    <div class="reference-row">
                            <div class="theme third-theme">
                                    <img src="img/theme3.png" alt="">
                                    <a href="#">Zjistit více</a>
                            </div>
                            <div class="theme fourth-theme">
                                    <img src="img/theme4.png" alt="">
                                    <a href="#">Zjistit více</a>
                            </div>
                    </div>
            </section>
    </main>


    <footer>
            <p>&copy; David Šetek 2021, Všechna práva vyhrazena</p>
    </footer>
</body>

</html>

我试图摆弄参数,控制参数,但它没有反应,代码只有在我使用函数注释掉 hte 代码时才有效

javascript function sass styling
© www.soinside.com 2019 - 2024. All rights reserved.