2017-03-23 5 views
0

작은 Cordova 애플리케이션을 작성하려고합니다. Fortunatly OnSenUI을 발견하고 현재 작업 중입니다. 그러나 나는이 erorr에 직면하고있다 :잡히지 않음 (약속 있음) 오류 : "html"은 하나의 래퍼 요소 여야합니다.

Uncaught (in promise) Error: "html" must be one wrapper element. at Object.util.createElement (util.js:147) at page-loader.js:23

나는 많은 해결책을 찾았지만 아무 것도 효과가 없었다.

내 전체 코드 :

<!DOCTYPE html> 
<html> 

<head> 
    <title>New App</title> 
    <meta charset="utf-8"> 
    <link rel="stylesheet" href="css/onsenui.css" /> 
    <link rel="stylesheet" href="css/onsen-css-components.css" /> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
    <script src="js/onsenui.js"></script> 
    <script src="js/myJs.js"></script> 

</head> 

<body> 
    <ons-splitter> 
     <ons-splitter-side id="menu" side="left" width="220px" collapse swipeable> 
      <ons-page> 
       <ons-list> 
        <ons-list-item onclick="fn.load('home.html')" tappable> Home </ons-list-item> 
        <ons-list-item id="ons-list-fetch" onclick="fn.load('fetchPage.html');" tappable> Fetch Data </ons-list-item> 
       </ons-list> 
      </ons-page> 
     </ons-splitter-side> 
     <ons-splitter-content id="content" page="home.html"></ons-splitter-content> 
    </ons-splitter> 
    <ons-template id="home.html"> 
     <ons-page id="helloworld-page"> 
      <ons-toolbar> 
       <div class="left"> 
        <ons-toolbar-button onclick="fn.open()"> 
         <ons-icon icon="md-menu"></ons-icon> 
        </ons-toolbar-button> 
       </div> 
       <div class="center"> Main </div> 
      </ons-toolbar> 
      <p style="text-align: center; opacity: 0.6; padding-top: 20px;"> Swipe right to open the menu! </p> 

<!-- Inputs--> 
      <h2 style="text-align: center; opacity: 0.6;">Just H2</h2> 
      <div style="text-align: center; margin-top: 30px;"> 
       <p> 
        <ons-input id="username" modifier="underbar" placeholder="Username" float></ons-input> 
       </p> 
       <p> 
        <ons-input id="password" modifier="underbar" type="password" placeholder="Password" float></ons-input> 
       </p> 
       <p style="margin-top: 30px;"> 
        <ons-button id="btnClickMe">Click Me!</ons-button> 
       </p> 

    <section style="padding: 8px"> 
    <ons-button modifier="quiet">Forgot Password</ons-button> 
    </section> 
    </div>  
<!-- eof Inputs--> 
<p style="text-align: center; font-size: 14px; opicity: 0.6"> All rights reserved </p> 
    </ons-page> 
    </ons-template> 

<!-- fetchPage--> 
<ons-template id="fetchPage.html"> 
<ons-page> 
      <ons-toolbar> 
       <div class="left"> 
        <ons-toolbar-button onclick="fn.open()"> 
         <ons-icon icon="md-menu"></ons-icon> 
        </ons-toolbar-button> 
       </div> 
       <div class="center"> Fetch </div> 
      </ons-toolbar> 
</ons-page> 
<div id="divFtechHere">Fetched Data will be shown here</div> 
</ons-template> 
</body> 
</html> 

답변

0

OMG 그것의 너무 단순.

<!-- FetchPage--> 
<ons-template id="fetchPage.html"> 
<ons-page> 
      <ons-toolbar> 
       <div class="left"> 
        <ons-toolbar-button onclick="fn.open()"> 
         <ons-icon icon="md-menu"></ons-icon> 
        </ons-toolbar-button> 
       </div> 
       <div class="center"> Fetch </div> 
      </ons-toolbar> 
</ons-page> 
<div id="divFtechHere">Fetched Data will be shown here</div> 
</ons-template> 

올바른 코드 :

<ons-template id="fetchPage.html"> 
<ons-page> 
      <ons-toolbar> 
       <div class="left"> 
        <ons-toolbar-button onclick="fn.open()"> 
         <ons-icon icon="md-menu"></ons-icon> 
        </ons-toolbar-button> 
       </div> 
       <div class="center"> Fetch </div> 
      </ons-toolbar> 
<div id="divFtechHere">Fetched Data will be shown here</div> 
</ons-page> 
</ons-template> 

나는 <ons-page>

잘못된 코드 외부 <div id="divFtechHere">를 선언했다