|
1 | 1 | {config_load file='default.conf'}{strip}
|
2 |
| - <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> |
3 |
| - <script src="https://unpkg.com/axios/dist/axios.min.js"></script> |
| 2 | +<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> |
| 3 | + <script src="https://unpkg.com/axios/dist/axios.min.js"></script> |
| 4 | + <div class="container" id="main"> |
| 5 | + <div class="row"> |
| 6 | + <h3>View made with Vue.js</h3> |
| 7 | + <p class="text-center text-primary"> {{ message }} </p> |
| 8 | + <p class="text-center text-secondary"> {{ message2 }} </p> |
| 9 | + </div> |
4 | 10 |
|
5 |
| - <div class="container" id="main"> |
6 |
| - <h1>View made with Vue.js</h1> |
7 |
| - <p> {{ message }} </p> |
8 |
| - </div> |
| 11 | + <div class="row"> |
| 12 | + <h3> Test Vue.js </h3> |
| 13 | + <button class="btn btn-default" v-on:click="getContentList"> List Content</button> |
| 14 | + <ul class="list-group" id="listCont" style="display: none;" ref="listCont"> |
| 15 | + <li v-for="item in contentList" class="list-group-item"> |
| 16 | + {{ item }} |
| 17 | + </li> |
| 18 | + </ul> |
| 19 | + </div> |
| 20 | + </div> |
9 | 21 |
|
10 |
| - <script type="text/javascript"> |
11 |
| - new Vue ({ |
12 |
| - el: '#main', |
13 |
| - data: { |
14 |
| - message = 'Este es un framework php front y back end', |
15 |
| - } |
16 |
| - }); |
17 |
| - </script> |
| 22 | + <script type="text/javascript"> |
| 23 | + var url = 'https://jsonplaceholder.typicode.com/users'; |
| 24 | + new Vue ({ |
| 25 | + el: '#main', |
| 26 | + data: { |
| 27 | + message: 'This is a complete PHP Framework', |
| 28 | + message2: 'The views were built with Vue.js framework', |
| 29 | + contentList: ['ORM', 'Views', 'Controllers', 'Router', 'Cache', 'SessionHandler', 'PHPUnit'], |
| 30 | + userList: [] |
| 31 | + }, |
| 32 | + methods: { |
| 33 | + getUserList: function () { |
| 34 | + axios.get(url).then(response => { |
| 35 | + this.userList = response.data |
| 36 | + }); |
| 37 | + }, |
| 38 | + getContentList: function () { |
| 39 | + this.$refs.listCont.style = 'block'; |
| 40 | + }, |
| 41 | + } |
| 42 | + }); |
| 43 | + </script> |
18 | 44 | {/strip}
|
0 commit comments