File size: 862 Bytes
8d1819a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>

<head>
    <title>Example component or modal</title>

    <!-- Import the alpine store -->
    <script type="module">
        import { store } from "/components/_examples/_example-store.js";
    </script>
</head>

<body>

    <!-- This construct of x-data + x-if is used to ensure the component is only rendered when the store is available -->
    <div x-data>
        <template x-if="$store.exampleStore">
            
            <!-- Keep in mind that <template> can have only one root element inside -->
            <div>
                <p x-text="$store.exampleStore.example1"></p>
                <p x-text="$store.exampleStore.example2"></p>
            </div>

        </template>
    </div>

    <!-- Optional style for the component -->
    <style>
        #example-component {
            width: 100%;
        }
    </style>

</body>

</html>