即使有源代码,Laravel刀片视图页面也是空的

时间:2017-02-15 13:49:00

标签: php laravel laravel-5.3 blade

我的刀片视图显示一个空白页面,但是如果我按CTRL + U来显示源代码,那么我得到了这个:

<!DOCTYPE html>
<html>
<head>
    <link rel='stylesheet' href='http://localhost/portal_testing/public/css/style.css'/>
    <script src='http://localhost/portal_testing/public/js/main.js'/>
</head>
<body>
    <div>   
        <div class='infoBox'>
            <h4 class='infoBoxTitle'>Log:</h4>
            <div class='infoBoxContent'> 
               <p>test</p>
            </div>
        </div>

        <div class='errorBox'>
            <h4 class='errorBoxTitle'>Error Log:</h4>
            <div class='errorBoxContent'> 
               <p>test</p>
            </div>
        </div>
    </div>
</body>
</html>

为什么即使有有效代码也无法渲染?

更新:

使用Javascript:

//Accordion:
var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
    acc[i].onclick = function(){
        this.classList.toggle("active");
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            panel.style.display = "none";
        } else {
            panel.style.display = "block";
        }
    }
}

CSS

.infoBox {
    font-family: arial;
    padding:2px;
    background-color: #DADADA;
    min-width: 300px;
    min-height: 100px;
    margin:2px;
    border:1px solid black;
}

.infoBoxTitle {
    padding:4px;
    font-size: 13px;
    color: red;
    margin: 1px;
    text-decoration: underline;

}

.infoBoxContent {
    font-size: 10px;
    padding-left:5px;
    margin-left:10px;
    border: 1px solid gray;
}

.errorBox {
    font-family: arial;
    padding:2px;
    background-color: #838383;
    min-width: 300px;
    min-height: 100px;
    margin:2px;
    border:1px solid black;
}

.errorBoxTitle {
    padding:4px;
    font-family: calibry;
    font-size: 13px;
    color: white;
    margin: 1px;
    text-decoration: underline;
}

.errorBoxContent {
    color: white;
    font-size: 11px;
    padding-left:5px;
    margin-left:10px;
    border: 4px solid white;
}

1 个答案:

答案 0 :(得分:0)

我发现了问题...... 我注意到所有内容都是在脚本标记内呈现的:

inspect html

原因是,因为脚本元素缺少它的结束标记。

<强>修正:

<script type="text/javascript" src='{{ URL::asset("js/main.js") }}'></script>