repl.it
@mathieudombrock/

VueJS Components

HTML, CSS, JS

An example of using VueJS components

fork
loading
Files
  • index.html
  • components.js
  • example_components.js
  • README.md
  • script.js
  • style.css
index.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>repl.it</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
  </head>
  <body>
    <div id="app">

      <!--Non-compoent based example-->
      <h2>Non-compoent based example</h2>
      <div v-for="game in games">
        <div>
          {{game.title}} - {{game.year}}
        </div>
        <div>
          Publisher: {{game.publisher}} | Developer: {{game.developer}}
        </div>
        <hr>
      </div>

      <!--Example Component 1-->
      <h2>Example Component 1</h2>
      <example-component></example-component>

      <!--Example Component 2-->
      <h2>Example Component 2</h2>
      <example-component-2 title="Super Mario World"  year="1991"></example-component-2>

      <!--Example Component 3-->
      <h2>Example Component 3</h2>
      <div v-for="game in games">
        <example-component-3 v-bind:data="game"></example-component-3>
      </div>

      <!--Example Component 4-->
      <h2>Example Component 4</h2>
      <example-component-4 v-bind:parent="this"></example-component-4>

      <!--Example Component 5-->
      <h2>Example Component 5</h2>
      <example-component-5></example-component-5>

      <!--Button Counter Example 1-->
      <h2>Button Counter Example 1</h2>
      <button-counter></button-counter>
      <button-counter></button-counter>
      <button-counter></button-counter>

      <!--Button Counter Example 2-->
      <h2>Button Counter Example 2</h2>
      <button-counter-2 offset="1"></button-counter-2>
      <button-counter-2 offset="5"></button-counter-2>
      <button-counter-2 offset="-1"></button-counter-2>

      <!--example-component-parent-1-->
      <h2>Example Component Parent 1</h2>
      <example-component-parent-1 v-bind:games="games"></example-component-parent-1>

      <!--real games list-->
      <h2>Final Games List</h2>
      <games-list v-bind:games="games"></games-list>
      
      <!--real games list 2-->
      <h2>Final Games List 2</h2>
      <games-list-2 v-bind:games="games"></games-list-2>

    </div>
    <script src="example_components.js"></script>
    <script src="components.js"></script>
    <script src="script.js"></script>
  </body>
</html>
result
console
?