Maxence Poutord - @_maxpou
Ignacio Velazquez - @nass600
Rewriting a whole existing app from scratch is risky and expensive
{{ title }}
const slide = new Vue({
el: '#app',
data: {
print: true,
title: 'Ludicrously straightforward syntax!'
}
})
Counter: {{ counter }}
(open Browser DevTools)
{{ question.title }}
View answers
var app = new Vue({
el: '#app',
data: {
question: {
title: 'How to pair socks from a pile efficiently?',
answered: true
}
}
})
var app = new Vue({
el: '#app',
data: {
question: {
title: 'How to pair socks from a pile efficiently?',
answered: true
}
}
})
{{ question.title }}
View answers
var app = new Vue({
el: '#app',
data: {
question: {
title: 'How to pair socks from a pile efficiently?',
answered: true
isActive: true
}
}
})
{{ question.title }}
var app = new Vue({
el: '#app',
data: {
questions: [
{ title: 'Why does ++[[]][+[]]+[+[]] return the string “10”?' },
{ title: 'What's the difference between JavaScript and Java?' },
{ title: 'Is it possible to apply CSS to half of a character?' }
]
}
})
Message: {{ message }}
Message: {{ message }}
git clone https://github.com/maxpou-slides/vue-workshop-app
git checkout step-0
npm install
npm run dev
⚠️ SoC is not about file separation!
// src/api/questions.js
import axios from 'axios'
export async function findAll (limit = 25) {
const response = await axios.get('questions/?limit=' + limit)
return response.data
}
import * as questionsApi from '../api/questions'
export default {
data () {
return {
questions: []
}
},
created () {
questionsApi.findAll().then((data) => {
this.questions = data
})
}
}
created()
?
Go to my account
Go to booking
// component declaration
const Account = { template: 'account' }
const QuestionList = { template: 'question list' }
const router = new VueRouter({
routes: [
{ path: '/account', component: Account },
{ path: '/questions', component: QuestionList }
]
})
const app = new Vue({
router
}).$mount('#app')
Maxence Poutord - @_maxpou
Ignacio Velazquez - @nass600