upgrade master to 5_start_new-project

This commit is contained in:
2022-10-01 17:50:16 +02:00
parent c66a8dc226
commit dff116af30
55 changed files with 4488 additions and 5528 deletions

View File

@@ -8,12 +8,5 @@
// any CSS you import will output into a single css file (app.css in this case)
import './styles/app.css';
// SCSS
import './styles/app.scss';
// start the Stimulus application
import './bootstrap';
// start VueJS application
import './vue';

View File

@@ -4,7 +4,7 @@ import { startStimulusApp } from '@symfony/stimulus-bridge';
export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true,
/\.(j|t)sx?$/
/\.[jt]sx?$/
));
// register any custom, 3rd party controllers here

View File

@@ -1,26 +0,0 @@
<template>
<div id="app">
<!-- la balise contacts corresponds au composant contacts passé ci-dessous -->
<contacts></contacts>
</div>
</template>
<script>
// importe dans contacts les datas d'une requête rest GET en json
import contacts from './Contacts.vue'
export default {
name: 'app',
components: {
// passe l'objet contacts comme composant
contacts,
}
}
</script>
<style>
#app {}
.container {}
.componentItem{}
</style>

View File

@@ -1,57 +0,0 @@
<template>
<div>
<table>
<tr v-for="contact in contacts">
<td>{{contact.firstname}}</td>
<td>{{contact.lastname}}</td>
</tr>
</table>
<button @click="addContact">Add</button>
<label>#contacts {{counter}}</label>
</div>
</template>
<script> // la balise script dans ce fichier vue, est un peu comme une classe Contacts
// namespace test1/Contacts
import Vue from 'vue'
import VueResource from 'vue-resource'
// injection de dépendance pour dealer du REST json
Vue.use(VueResource)
export default{
// initialise les données
data () {
return { // constructeur du tableau-objet vide 'contacts' qui est passé à App.vue
contacts: []
}
},
// Rest GET json
http: {
root: 'http://localhost:3000'
},
// méthodes
methods: {
addContact(){
this.contacts.push({"firstname":"Lisa", "lastname":"Simpson", "age":"10"})
}
},
// traitements
computed:{
counter(){
return this.contacts.length
}
},
// on dirait un setter
mounted() {
this.$resource('contacts').get().then((response) => {
this.contacts = response.data
}, (response) => {
console.log('erreur', response);
})
}
}
</script>
<style>
</style>

View File

@@ -1,4 +1,4 @@
import { Controller } from 'stimulus';
import { Controller } from '@hotwired/stimulus';
/*
* This is an example Stimulus controller!

View File

@@ -1,8 +0,0 @@
import Vue from 'vue'
import App from './components/App.vue'
new Vue({
el: '#app',
render: h => h(App)
})