Alpine.js include template file.html

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite App</title>
  </head>
  <body>

    <div x-data>
        <template x-route="/" x-template.preload.target.app="/home.html"></template>



        <div id="app"></div>
        <div x-data="maindata">
            <div x-html="await (await fetch('footer.html')).text()"></div>
            <div x-html="jenis1()"></div>
            <div x-html="jenis2"></div>
        </div>
    </div>

    <script>

      let jenis2 =  async () =>{
        return (await fetch('footer.html')).text() 
      }

      let maindata = () =>{
        return {
          async jenis1() { 
            return await (await fetch('footer.html')).text() 
          
          }
        }
      }


      
  </script>

    <script type="module" src="./src/main.js"></script>

  </body>
</html>

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *