SlideShare uma empresa Scribd logo
1 de 39
Baixar para ler offline
Vue.js - Zastosowanie i budowa
komponentów
Amadeusz Kozłowski
Front End Developer
amadeuszkozlowski@gmail.com
#1 - Tree organized
#2 - Single - file component
<template>
<div v-if=”isActive”>
{{ message }}
</div>
</template>
<script>
export default {
props: [],
data() {
return {
isActive: ‘false’,
message:
‘lorem’,
}
},
methods: {
}
}
</script>
Vue.component('stepper-form',
require('./components/StepperForm.vue'));
const app = new Vue({
el: '#app'
});
#3 - Props
Vue.component('blog-post', {
props: ['title'],
template: '<h3>{{ title }}</h3>'
})
<blog-post title="My journey with Vue"></blog-post>
<blog-post title="Blogging with Vue"></blog-post>
<h3>My journey with Vue</h3>
<h3>Blogging with Vue</h3>
#3 - Props
Vue.component('blog-post', {
props: ['title'],
props: {
title: {
default: 'Lorem title',
type: String
}
},
template: '<h3>{{ title }}</h3>'
})
<blog-post title="My journey with Vue"></blog-post>
<blog-post title="Blogging with Vue"></blog-post>
<blog-post></blog-post>
<h3>My journey with Vue</h3>
<h3>Blogging with Vue</h3>
<h3>Lorem title</h3>
#4 - v-for
<blog-post
v-for="post in posts"
v-bind:key="post.id"
v-bind:title="post.title"
></blog-post>
v-bind: = :
#5 - Events
<button v-on:click="$emit('enlarge-text', 2)">
Enlarge text
</button>
<blog-post
...
v-on:enlarge-text="postFontSize += $event"
></blog-post>
v-on: = @
#6 - v-model
<input v-model="searchText">
does the same thing as:
<input
v-bind:value="searchText"
v-on:input="searchText = $event.target.value"
>
#7 - Slots
Vue.component('alert-box', {
template: `
<div class="demo-alert-
box">
<slot></slot>
</div>`
})
<alert-box>
Something bad happened.
</alert-box>
<div class="demo-alert-box">
Something bad happened.
</div>
#8 - Form Stepper
#9 - Blade + Design <div class="container py-8" id="app">
<div class="w-full">
<div class="border border-grey p-4 text-right mb-8 lg:mb-0">
<button class="btn btn--black mr-4 w-24">Powrót</button>
<button class="btn btn--green w-24">Dalej</button>
<button class="btn btn--red w-24">Wyślij</button>
</div>
<div class="flex flex-col lg:flex-row items-center w-full justify-between lg:py-8">
<ul class="steps flex items-center justify-center flex-col mb-8 lg:mb-0 h-screen/2">
<li class="step line done cursor-pointer"><span>1</span></li>
<li class="step line active"><span>2</span></li>
<li class="step pointer-events-none"><span>3</span></li>
</ul>
<div class="lg:mr-auto lg:ml-8">
<form action="/">
<div>
<h2 class="mb-4">Krok 1</h2>
<div class="grid grid-columns-1 grid-gap-8">
<label class="font-bold" for="name">Imię*
<input class="mt-2 w-full" type="text" name="name" id="name">
</label>
<label class="font-bold" for="second_name">Nazwisko*
<input class="mt-2 w-full" type="text" name="second_name"
id="second_name">
</label>
</div>
</div>
</form>
</div>
<div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8">
<img src="{{ asset('images/Vue.jpg') }}" alt="">
</div>
</div>
</div>
</div>
#9 - Blade + Design <div class="container py-8" id="app">
<div class="w-full">
<div class="border border-grey p-4 text-right mb-8 lg:mb-0">
<button class="btn btn--black mr-4 w-24">Powrót</button>
<button class="btn btn--green w-24">Dalej</button>
<button class="btn btn--red w-24">Wyślij</button>
</div>
<div class="flex flex-col lg:flex-row items-center w-full justify-between lg:py-8">
<ul class="steps flex items-center justify-center flex-col mb-8 lg:mb-0 h-screen/2">
<li class="step line done cursor-pointer"><span>1</span></li>
<li class="step line active"><span>2</span></li>
<li class="step pointer-events-none"><span>3</span></li>
</ul>
<div class="lg:mr-auto lg:ml-8">
<form action="/">
<div>
<h2 class="mb-4">Krok 1</h2>
<div class="grid grid-columns-1 grid-gap-8">
<label class="font-bold" for="name">Imię*
<input class="mt-2 w-full" type="text" name="name" id="name">
</label>
<label class="font-bold" for="second_name">Nazwisko*
<input class="mt-2 w-full" type="text" name="second_name"
id="second_name">
</label>
</div>
</div>
</form>
</div>
<div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8">
<img src="{{ asset('images/Vue.jpg') }}" alt="">
</div>
</div>
</div>
</div>
#9 - Blade + Design
<div class="border border-grey p-4 text-right mb-8 lg:mb-0">
<button class="btn btn--black mr-4 w-24">Powrót</button>
<button class="btn btn--green w-24">Dalej</button>
<button class="btn btn--red w-24">Wyślij</button>
</div>
#9 - Blade + Design
<ul class="steps flex items-center justify-center flex-col mb-8 lg:mb-0 h-screen/2">
<li class="step line done cursor-pointer"><span>1</span></li>
<li class="step line active"><span>2</span></li>
<li class="step pointer-events-none"><span>3</span></li>
</ul>
#9 - Blade + Design
<div class="lg:mr-auto lg:ml-8">
<form action="/">
<div>
<h2 class="mb-4">Krok 1</h2>
<div class="grid grid-columns-1 grid-gap-8">
<label class="font-bold" for="name">Imię*
<input class="mt-2 w-full" type="text"
name="name" id="name">
</label>
<label class="font-bold" for="second_name">Nazwisko*
<input class="mt-2 w-full" type="text"
name="second_name" id="second_name">
</label>
</div>
</div>
</form>
</div>
#10 Vue <- Blade <div class="container py-8" id="app">
<div class="w-full">
<div class="border border-grey p-4 text-right mb-8 lg:mb-0">
<button class="btn btn--black mr-4 w-24">Powrót</button>
<button class="btn btn--green w-24">Dalej</button>
<button class="btn btn--red w-24">Wyślij</button>
</div>
<div class="flex flex-col lg:flex-row items-center w-full justify-between lg:py-8">
<ul class="steps flex items-center justify-center flex-col mb-8 lg:mb-0 h-screen/2">
<li class="step line done cursor-pointer"><span>1</span></li>
<li class="step line active"><span>2</span></li>
<li class="step pointer-events-none"><span>3</span></li>
</ul>
<div class="lg:mr-auto lg:ml-8">
<form action="/">
<div>
<h2 class="mb-4">Krok 1</h2>
<div class="grid grid-columns-1 grid-gap-8">
<label class="font-bold" for="name">Imię*
<input class="mt-2 w-full" type="text" name="name" id="name">
</label>
<label class="font-bold" for="second_name">Nazwisko*
<input class="mt-2 w-full" type="text" name="second_name"
id="second_name">
</label>
</div>
</div>
</form>
</div>
<div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8">
<img src="{{ asset('images/Vue.jpg') }}" alt="">
</div>
</div>
</div>
</div>
<div class="container py-8" id="app">
<stepper-parent>
<div class="lg:mr-auto lg:ml-8">
<form action="/">
<stepper-form :active="true">
@include('form.form1')
</stepper-form>
<stepper-form>
@include('form.form2')
</stepper-form>
<stepper-form>
@include('form.form3')
</stepper-form>
</form>
</div>
<div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8">
<img src="{{ asset('images/Vue.jpg') }}" alt="">
</div>
</stepper-parent>
</div>
#11 Using slot
<template>
<div class="w-full">
<div class="border border-grey p-4 text-right mb-8 lg:mb-0"
<button class="btn btn--black mr-4 w-24">Powrót</butto
<button class="btn btn--green w-24">Dalej</button>
<button class="btn btn--red w-24">Wyślij</button>
</div>
<div class="flex flex-col lg:flex-row items-center w-full
justify-between lg:py-8">
<ul class="steps flex items-center justify-center flex-col m
lg:mb-0 h-screen/2">
<li class="step line done cursor-pointer"><span>1</sp
<li class="step line active"><span>2</span></li>
<li class="step pointer-events-none"><span>3</span>
</ul>
<slot></slot>
</div>
</div>
</template>
<div class="container py-8" id="app">
<stepper-parent>
<div class="lg:mr-auto lg:ml-8">
<form action="/">
<stepper-form :active="true">
@include('form.form1')
</stepper-form>
<stepper-form>
@include('form.form2')
</stepper-form>
<stepper-form>
@include('form.form3')
</stepper-form>
</form>
</div>
<div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8">
<img src="{{ asset('images/Vue.jpg') }}" alt="">
</div>
</stepper-parent>
</div>
#12 - https://baianat.github.io/vee-validate/
VeeValidate
Input validation for Vue.js
#12 - https://baianat.github.io/vee-validate/
<h2 class="mb-4">Krok 1</h2>
<div class="grid grid-columns-1 grid-gap-8">
<label class="font-bold" for="name">Imię*
<input v-validate="'required'" class="mt-2 w-full" v-model="form.name" type="text"
name="name"
id="name">
<p v-show="errors.has('name')" class="text-green text-xs mt-2 md:absolute">@{{ errors.first('name') }}</p>
</label>
<label class="font-bold" for="second_name">Nazwisko*
<input v-validate="'required'" class="mt-2 w-full" v-model="form.secondName" type="text"
name="second_name"
id="second_name">
<p v-show="errors.has('second_name')"
class="text-green text-xs mt-2 md:absolute">@{{ errors.first('second_name') }}</p>
</label>
</div>
#13 - [stepper-form] init empty
<template>
<div>
<slot></slot>
</div>
</template>
<div class="container py-8" id="app">
<stepper-parent>
<div class="lg:mr-auto lg:ml-8">
<form action="/">
<stepper-form :active="true">
@include('form.form1')
</stepper-form>
<stepper-form>
@include('form.form2')
</stepper-form>
<stepper-form>
@include('form.form3')
</stepper-form>
</form>
</div>
<div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8">
<img src="{{ asset('images/Vue.jpg') }}" alt="">
</div>
</stepper-parent>
</div>
#14 - [app.js] init components
require('./bootstrap');
window.Vue = require('vue');
Vue.component('stepper-parent', require('./components/StepperParent.vue'));
Vue.component('stepper-form', require('./components/StepperForm.vue'));
import VeeValidate from 'vee-validate';
Vue.use(VeeValidate);
const app = new Vue({
data: {
form: {},
},
el: '#app'
});
#15 - [stepper-form] displaying steps
<template>
<transition name="slide" mode="in-out">
<div v-if="isActive">
<slot></slot>
</div>
</transition>
</template>
<script>
export default {
props: {
active: {
default: false,
type: Boolean,
}
},
#15 - [stepper-form] displaying steps
data() {
return {
isActive: false,
}
},
methods: {
open() {
this.isActive = true;
},
close() {
this.isActive = false;
},
toggle() {
return this.isActive ? this.close() : this.open();
}
},
mounted() {
if (this.active) {
this.open();
}
}
}
</script>
#16 - Animations
<style>
.slide-enter-active, .slide-leave-active {
transition: all .5s;
}
.slide-enter, .slide-leave-to
{
opacity: 0;
height: 0;
transform: translateX(100px) scale(0.1) rotate(-15deg);
}
.fade-enter-active, .fade-leave-active {
transition: opacity .5s;
}
.fade-enter, .fade-leave-to
{
opacity: 0;
}
</style>
#17 - [stepper-parent] init data
data() {
return {
totalSteps: 0,
actualStep: 1,
validated: 1,
}
},
mounted() {
this.totalSteps = this.$children.length;
}
#17 - [stepper-parent] init data
#17 - [stepper-parent] dynamic steps
<li v-for="step in totalSteps" :key="step"
class="step" @click="goToStep(step)"
:class="{ active: step === actualStep,
line: step < totalSteps,
'done cursor-pointer': step < actualStep || step <= validated,
'pointer-events-none': step > validated }">
<span>{{ step }}</span>
</li>
<ul class="steps flex items-center justify-center flex-col mb-8 lg:mb-0 h-screen/2">
<li class="step line done cursor-pointer"><span>1</span></li>
<li class="step line active"><span>2</span></li>
<li class="step pointer-events-none"><span>3</span></li>
</ul>
Aby odtworzyć film kliknij tutaj
#18 - [stepper-parent] dynamic buttons
<transition name="fade" mode="in-out">
<button v-show="actualStep !== 1"
class="btn btn--black mr-4 w-24"
@click="backStep">Powrót</button>
</transition>
<button :class="{'btn--green': actualStep < totalSteps,
'btn--red': actualStep === totalSteps,}"
class="btn w-24"
@click="nextButtonAction">
{{ actualStep < totalSteps ? 'Dalej' : 'Wyślij' }}
</button>
#19 - [stepper-parent] next prev logic
nextStep() {
this.goToStep(this.actualStep + 1);
if (this.actualStep > this.validated) {
this.validated++;
}
},
backStep() {
this.goToStep(this.actualStep - 1);
},
goToStep(step) {
this.$children[this.actualStep - 1].close();
this.actualStep = step;
let $this = this;
setTimeout(function () {
$this.$children[$this.actualStep - 1].open();
}, 500);
},
#19 - [stepper-parent] next prev logic
nextButtonAction() {
this.$parent.$validator.validate().then(result => {
if (!result) {
// invalid
return null;
}
else {
// valid
if (this.actualStep < this.totalSteps) {
return this.nextStep();
}
else {
return this.submit();
}
}
});
},
submit() {
alert(JSON.stringify(this.$parent.form, null, 4));
},
Aby odtworzyć film kliknij tutaj
Aby odtworzyć film kliknij tutaj
#20 - v-cloak
<stepper-parent>
<div class="lg:mr-auto lg:ml-8" v-cloak>
<form action="/">
<stepper-form :active="true">
@include('form.form1')
</stepper-form>
<stepper-form>
@include('form.form2')
</stepper-form>
<stepper-form>
@include('form.form3')
</stepper-form>
</form>
</div>
<div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8">
<img src="{{ asset('images/Vue.jpg') }}" alt="">
</div>
</stepper-parent>
[v-cloak] {
display: none;
}
Aby odtworzyć film kliknij tutaj
Amadeusz Kozłowski
amadeuszkozlowski@gmail.com

Mais conteúdo relacionado

Mais procurados

2012.sandiego.wordcamp
2012.sandiego.wordcamp2012.sandiego.wordcamp
2012.sandiego.wordcampBrandon Dove
 
Data binding 入門淺談
Data binding 入門淺談Data binding 入門淺談
Data binding 入門淺談awonwon
 
jQuery Mobile: Progressive Enhancement with HTML5
jQuery Mobile: Progressive Enhancement with HTML5jQuery Mobile: Progressive Enhancement with HTML5
jQuery Mobile: Progressive Enhancement with HTML5Todd Anderson
 
Angular js quickstart
Angular js quickstartAngular js quickstart
Angular js quickstartLinkMe Srl
 
Knockout mvvm-m5-slides
Knockout mvvm-m5-slidesKnockout mvvm-m5-slides
Knockout mvvm-m5-slidesMasterCode.vn
 
Bootstrap 3 Cheat Sheet PDF Reference
Bootstrap 3 Cheat Sheet PDF ReferenceBootstrap 3 Cheat Sheet PDF Reference
Bootstrap 3 Cheat Sheet PDF ReferenceBootstrap Creative
 
W3C XBL 2.0 and Widgets 1.0
W3C XBL 2.0 and Widgets 1.0 W3C XBL 2.0 and Widgets 1.0
W3C XBL 2.0 and Widgets 1.0 Marcos Caceres
 
jQuery Mobile with HTML5
jQuery Mobile with HTML5jQuery Mobile with HTML5
jQuery Mobile with HTML5madhurpgarg
 
Unlock the next era of UI design with Polymer
Unlock the next era of UI design with PolymerUnlock the next era of UI design with Polymer
Unlock the next era of UI design with PolymerRob Dodson
 
Django class based views for beginners
Django class based views for beginnersDjango class based views for beginners
Django class based views for beginnersSpin Lai
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Rakesh Jha
 
Hastening React SSR - Web Performance San Diego
Hastening React SSR - Web Performance San DiegoHastening React SSR - Web Performance San Diego
Hastening React SSR - Web Performance San DiegoMaxime Najim
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoRob Bontekoe
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of usOSCON Byrum
 
Jinja2 Templates - San Francisco Flask Meetup
Jinja2 Templates - San Francisco Flask MeetupJinja2 Templates - San Francisco Flask Meetup
Jinja2 Templates - San Francisco Flask MeetupAlan Hamlett
 

Mais procurados (20)

2012.sandiego.wordcamp
2012.sandiego.wordcamp2012.sandiego.wordcamp
2012.sandiego.wordcamp
 
Data binding 入門淺談
Data binding 入門淺談Data binding 入門淺談
Data binding 入門淺談
 
jQuery Mobile: Progressive Enhancement with HTML5
jQuery Mobile: Progressive Enhancement with HTML5jQuery Mobile: Progressive Enhancement with HTML5
jQuery Mobile: Progressive Enhancement with HTML5
 
Angular js quickstart
Angular js quickstartAngular js quickstart
Angular js quickstart
 
Knockout mvvm-m5-slides
Knockout mvvm-m5-slidesKnockout mvvm-m5-slides
Knockout mvvm-m5-slides
 
Client Web
Client WebClient Web
Client Web
 
Bootstrap 3 Cheat Sheet PDF Reference
Bootstrap 3 Cheat Sheet PDF ReferenceBootstrap 3 Cheat Sheet PDF Reference
Bootstrap 3 Cheat Sheet PDF Reference
 
W3C XBL 2.0 and Widgets 1.0
W3C XBL 2.0 and Widgets 1.0 W3C XBL 2.0 and Widgets 1.0
W3C XBL 2.0 and Widgets 1.0
 
Stripes Framework
Stripes FrameworkStripes Framework
Stripes Framework
 
jQuery Mobile with HTML5
jQuery Mobile with HTML5jQuery Mobile with HTML5
jQuery Mobile with HTML5
 
Unlock the next era of UI design with Polymer
Unlock the next era of UI design with PolymerUnlock the next era of UI design with Polymer
Unlock the next era of UI design with Polymer
 
22 j query1
22 j query122 j query1
22 j query1
 
Django class based views for beginners
Django class based views for beginnersDjango class based views for beginners
Django class based views for beginners
 
Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap Advanced JQuery Mobile tutorial with Phonegap
Advanced JQuery Mobile tutorial with Phonegap
 
Why Django for Web Development
Why Django for Web DevelopmentWhy Django for Web Development
Why Django for Web Development
 
Polymer
PolymerPolymer
Polymer
 
Hastening React SSR - Web Performance San Diego
Hastening React SSR - Web Performance San DiegoHastening React SSR - Web Performance San Diego
Hastening React SSR - Web Performance San Diego
 
Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
 
Jinja2 Templates - San Francisco Flask Meetup
Jinja2 Templates - San Francisco Flask MeetupJinja2 Templates - San Francisco Flask Meetup
Jinja2 Templates - San Francisco Flask Meetup
 

Semelhante a Vue.js - zastosowanie i budowa komponentów

Index of jquery template 2 Minuteman Summer Web Dev.
Index of jquery template 2 Minuteman Summer Web Dev.Index of jquery template 2 Minuteman Summer Web Dev.
Index of jquery template 2 Minuteman Summer Web Dev.Daniel Downs
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.jsVioletta Villani
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.jsCommit University
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshowsblackman
 
Introduction to Vue.js
Introduction to Vue.jsIntroduction to Vue.js
Introduction to Vue.jsMeir Rotstein
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckAnthony Montalbano
 
Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015buildstudio
 
Technical Preview: The New Shopware Admin
Technical Preview: The New Shopware AdminTechnical Preview: The New Shopware Admin
Technical Preview: The New Shopware AdminPhilipp Schuch
 
Modern frontend development with VueJs
Modern frontend development with VueJsModern frontend development with VueJs
Modern frontend development with VueJsTudor Barbu
 
Enjoy the vue.js
Enjoy the vue.jsEnjoy the vue.js
Enjoy the vue.jsTechExeter
 
BPM-2 Introduction to Advanced Workflows
BPM-2 Introduction to Advanced WorkflowsBPM-2 Introduction to Advanced Workflows
BPM-2 Introduction to Advanced WorkflowsAlfresco Software
 

Semelhante a Vue.js - zastosowanie i budowa komponentów (20)

iWebkit
iWebkitiWebkit
iWebkit
 
Index of jquery template 2 Minuteman Summer Web Dev.
Index of jquery template 2 Minuteman Summer Web Dev.Index of jquery template 2 Minuteman Summer Web Dev.
Index of jquery template 2 Minuteman Summer Web Dev.
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.js
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.js
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
Xxx
XxxXxx
Xxx
 
JQuery Mobile UI
JQuery Mobile UIJQuery Mobile UI
JQuery Mobile UI
 
Introduction to Vue.js
Introduction to Vue.jsIntroduction to Vue.js
Introduction to Vue.js
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
 
Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015
 
HTML5 Essentials
HTML5 EssentialsHTML5 Essentials
HTML5 Essentials
 
Technical Preview: The New Shopware Admin
Technical Preview: The New Shopware AdminTechnical Preview: The New Shopware Admin
Technical Preview: The New Shopware Admin
 
Vue.js for beginners
Vue.js for beginnersVue.js for beginners
Vue.js for beginners
 
Modern frontend development with VueJs
Modern frontend development with VueJsModern frontend development with VueJs
Modern frontend development with VueJs
 
Test upload
Test uploadTest upload
Test upload
 
Enjoy the vue.js
Enjoy the vue.jsEnjoy the vue.js
Enjoy the vue.js
 
Flask – Python
Flask – PythonFlask – Python
Flask – Python
 
BPM-2 Introduction to Advanced Workflows
BPM-2 Introduction to Advanced WorkflowsBPM-2 Introduction to Advanced Workflows
BPM-2 Introduction to Advanced Workflows
 

Mais de Laravel Poland MeetUp

WebRTC+Websockety - Jak stworzyłem aplikację do kamerek internetowych w Larav...
WebRTC+Websockety - Jak stworzyłem aplikację do kamerek internetowych w Larav...WebRTC+Websockety - Jak stworzyłem aplikację do kamerek internetowych w Larav...
WebRTC+Websockety - Jak stworzyłem aplikację do kamerek internetowych w Larav...Laravel Poland MeetUp
 
xD bug - Jak debugować PHP-owe aplikacje (Xdebug)
xD bug - Jak debugować PHP-owe aplikacje (Xdebug) xD bug - Jak debugować PHP-owe aplikacje (Xdebug)
xD bug - Jak debugować PHP-owe aplikacje (Xdebug) Laravel Poland MeetUp
 
Kilka slajdów o castowaniu atrybutów w Eloquent
Kilka slajdów o castowaniu atrybutów w EloquentKilka slajdów o castowaniu atrybutów w Eloquent
Kilka slajdów o castowaniu atrybutów w EloquentLaravel Poland MeetUp
 
Jak przyspieszyłem aplikację produkcyjną o ponad 40%
Jak przyspieszyłem aplikację produkcyjną o ponad 40%Jak przyspieszyłem aplikację produkcyjną o ponad 40%
Jak przyspieszyłem aplikację produkcyjną o ponad 40%Laravel Poland MeetUp
 
Cykl życia zapytania HTTP (pod maską)
Cykl życia zapytania HTTP (pod maską)Cykl życia zapytania HTTP (pod maską)
Cykl życia zapytania HTTP (pod maską)Laravel Poland MeetUp
 
Enumy w Laravelu - dlaczego warto stosować?
Enumy w Laravelu - dlaczego warto stosować?Enumy w Laravelu - dlaczego warto stosować?
Enumy w Laravelu - dlaczego warto stosować?Laravel Poland MeetUp
 
Laravelowe paczki do uwierzytelniania
Laravelowe paczki do uwierzytelnianiaLaravelowe paczki do uwierzytelniania
Laravelowe paczki do uwierzytelnianiaLaravel Poland MeetUp
 
Przegląd najciekawszych wtyczek do Laravela
Przegląd najciekawszych wtyczek do LaravelaPrzegląd najciekawszych wtyczek do Laravela
Przegląd najciekawszych wtyczek do LaravelaLaravel Poland MeetUp
 
Laravel Dusk - prosty przepis na testy E2E
Laravel Dusk - prosty przepis na testy E2ELaravel Dusk - prosty przepis na testy E2E
Laravel Dusk - prosty przepis na testy E2ELaravel Poland MeetUp
 
Laravel Octane - czy na pewno taki szybki?
Laravel Octane - czy na pewno taki szybki?Laravel Octane - czy na pewno taki szybki?
Laravel Octane - czy na pewno taki szybki?Laravel Poland MeetUp
 
Automatyzacja utrzymania jakości w środowisku PHP
Automatyzacja utrzymania jakości w środowisku PHPAutomatyzacja utrzymania jakości w środowisku PHP
Automatyzacja utrzymania jakości w środowisku PHPLaravel Poland MeetUp
 
Wstęp do Gitlab CI/CD w aplikacjach napisanych w Laravel
Wstęp do Gitlab CI/CD w aplikacjach napisanych w LaravelWstęp do Gitlab CI/CD w aplikacjach napisanych w Laravel
Wstęp do Gitlab CI/CD w aplikacjach napisanych w LaravelLaravel Poland MeetUp
 

Mais de Laravel Poland MeetUp (20)

WebRTC+Websockety - Jak stworzyłem aplikację do kamerek internetowych w Larav...
WebRTC+Websockety - Jak stworzyłem aplikację do kamerek internetowych w Larav...WebRTC+Websockety - Jak stworzyłem aplikację do kamerek internetowych w Larav...
WebRTC+Websockety - Jak stworzyłem aplikację do kamerek internetowych w Larav...
 
xD bug - Jak debugować PHP-owe aplikacje (Xdebug)
xD bug - Jak debugować PHP-owe aplikacje (Xdebug) xD bug - Jak debugować PHP-owe aplikacje (Xdebug)
xD bug - Jak debugować PHP-owe aplikacje (Xdebug)
 
Kilka slajdów o castowaniu atrybutów w Eloquent
Kilka slajdów o castowaniu atrybutów w EloquentKilka slajdów o castowaniu atrybutów w Eloquent
Kilka slajdów o castowaniu atrybutów w Eloquent
 
Licencje otwartego oprogramowania
Licencje otwartego oprogramowaniaLicencje otwartego oprogramowania
Licencje otwartego oprogramowania
 
Jak przyspieszyłem aplikację produkcyjną o ponad 40%
Jak przyspieszyłem aplikację produkcyjną o ponad 40%Jak przyspieszyłem aplikację produkcyjną o ponad 40%
Jak przyspieszyłem aplikację produkcyjną o ponad 40%
 
Jak przemycić Shape Up do Scruma?
Jak przemycić Shape Up do Scruma?Jak przemycić Shape Up do Scruma?
Jak przemycić Shape Up do Scruma?
 
Cykl życia zapytania HTTP (pod maską)
Cykl życia zapytania HTTP (pod maską)Cykl życia zapytania HTTP (pod maską)
Cykl życia zapytania HTTP (pod maską)
 
Enumy w Laravelu - dlaczego warto stosować?
Enumy w Laravelu - dlaczego warto stosować?Enumy w Laravelu - dlaczego warto stosować?
Enumy w Laravelu - dlaczego warto stosować?
 
Laravelowe paczki do uwierzytelniania
Laravelowe paczki do uwierzytelnianiaLaravelowe paczki do uwierzytelniania
Laravelowe paczki do uwierzytelniania
 
Przegląd najciekawszych wtyczek do Laravela
Przegląd najciekawszych wtyczek do LaravelaPrzegląd najciekawszych wtyczek do Laravela
Przegląd najciekawszych wtyczek do Laravela
 
Walidacja w Laravelu
Walidacja w LaraveluWalidacja w Laravelu
Walidacja w Laravelu
 
(prawie) Wszystko o Tinkerze
(prawie) Wszystko o Tinkerze(prawie) Wszystko o Tinkerze
(prawie) Wszystko o Tinkerze
 
Laravel Dusk - prosty przepis na testy E2E
Laravel Dusk - prosty przepis na testy E2ELaravel Dusk - prosty przepis na testy E2E
Laravel Dusk - prosty przepis na testy E2E
 
Laravel Octane - czy na pewno taki szybki?
Laravel Octane - czy na pewno taki szybki?Laravel Octane - czy na pewno taki szybki?
Laravel Octane - czy na pewno taki szybki?
 
Laravel Jobs i PHP8
Laravel Jobs i PHP8Laravel Jobs i PHP8
Laravel Jobs i PHP8
 
Wszystko o Laravel Livewire
Wszystko o Laravel Livewire Wszystko o Laravel Livewire
Wszystko o Laravel Livewire
 
Laravel/PHP - zderzenie z PDFami
Laravel/PHP - zderzenie z PDFamiLaravel/PHP - zderzenie z PDFami
Laravel/PHP - zderzenie z PDFami
 
Action-based Laravel
Action-based LaravelAction-based Laravel
Action-based Laravel
 
Automatyzacja utrzymania jakości w środowisku PHP
Automatyzacja utrzymania jakości w środowisku PHPAutomatyzacja utrzymania jakości w środowisku PHP
Automatyzacja utrzymania jakości w środowisku PHP
 
Wstęp do Gitlab CI/CD w aplikacjach napisanych w Laravel
Wstęp do Gitlab CI/CD w aplikacjach napisanych w LaravelWstęp do Gitlab CI/CD w aplikacjach napisanych w Laravel
Wstęp do Gitlab CI/CD w aplikacjach napisanych w Laravel
 

Último

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 

Último (20)

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 

Vue.js - zastosowanie i budowa komponentów

  • 1. Vue.js - Zastosowanie i budowa komponentów
  • 2. Amadeusz Kozłowski Front End Developer amadeuszkozlowski@gmail.com
  • 3. #1 - Tree organized
  • 4. #2 - Single - file component <template> <div v-if=”isActive”> {{ message }} </div> </template> <script> export default { props: [], data() { return { isActive: ‘false’, message: ‘lorem’, } }, methods: { } } </script> Vue.component('stepper-form', require('./components/StepperForm.vue')); const app = new Vue({ el: '#app' });
  • 5. #3 - Props Vue.component('blog-post', { props: ['title'], template: '<h3>{{ title }}</h3>' }) <blog-post title="My journey with Vue"></blog-post> <blog-post title="Blogging with Vue"></blog-post> <h3>My journey with Vue</h3> <h3>Blogging with Vue</h3>
  • 6. #3 - Props Vue.component('blog-post', { props: ['title'], props: { title: { default: 'Lorem title', type: String } }, template: '<h3>{{ title }}</h3>' }) <blog-post title="My journey with Vue"></blog-post> <blog-post title="Blogging with Vue"></blog-post> <blog-post></blog-post> <h3>My journey with Vue</h3> <h3>Blogging with Vue</h3> <h3>Lorem title</h3>
  • 7. #4 - v-for <blog-post v-for="post in posts" v-bind:key="post.id" v-bind:title="post.title" ></blog-post> v-bind: = :
  • 8. #5 - Events <button v-on:click="$emit('enlarge-text', 2)"> Enlarge text </button> <blog-post ... v-on:enlarge-text="postFontSize += $event" ></blog-post> v-on: = @
  • 9. #6 - v-model <input v-model="searchText"> does the same thing as: <input v-bind:value="searchText" v-on:input="searchText = $event.target.value" >
  • 10. #7 - Slots Vue.component('alert-box', { template: ` <div class="demo-alert- box"> <slot></slot> </div>` }) <alert-box> Something bad happened. </alert-box> <div class="demo-alert-box"> Something bad happened. </div>
  • 11. #8 - Form Stepper
  • 12. #9 - Blade + Design <div class="container py-8" id="app"> <div class="w-full"> <div class="border border-grey p-4 text-right mb-8 lg:mb-0"> <button class="btn btn--black mr-4 w-24">Powrót</button> <button class="btn btn--green w-24">Dalej</button> <button class="btn btn--red w-24">Wyślij</button> </div> <div class="flex flex-col lg:flex-row items-center w-full justify-between lg:py-8"> <ul class="steps flex items-center justify-center flex-col mb-8 lg:mb-0 h-screen/2"> <li class="step line done cursor-pointer"><span>1</span></li> <li class="step line active"><span>2</span></li> <li class="step pointer-events-none"><span>3</span></li> </ul> <div class="lg:mr-auto lg:ml-8"> <form action="/"> <div> <h2 class="mb-4">Krok 1</h2> <div class="grid grid-columns-1 grid-gap-8"> <label class="font-bold" for="name">Imię* <input class="mt-2 w-full" type="text" name="name" id="name"> </label> <label class="font-bold" for="second_name">Nazwisko* <input class="mt-2 w-full" type="text" name="second_name" id="second_name"> </label> </div> </div> </form> </div> <div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8"> <img src="{{ asset('images/Vue.jpg') }}" alt=""> </div> </div> </div> </div>
  • 13. #9 - Blade + Design <div class="container py-8" id="app"> <div class="w-full"> <div class="border border-grey p-4 text-right mb-8 lg:mb-0"> <button class="btn btn--black mr-4 w-24">Powrót</button> <button class="btn btn--green w-24">Dalej</button> <button class="btn btn--red w-24">Wyślij</button> </div> <div class="flex flex-col lg:flex-row items-center w-full justify-between lg:py-8"> <ul class="steps flex items-center justify-center flex-col mb-8 lg:mb-0 h-screen/2"> <li class="step line done cursor-pointer"><span>1</span></li> <li class="step line active"><span>2</span></li> <li class="step pointer-events-none"><span>3</span></li> </ul> <div class="lg:mr-auto lg:ml-8"> <form action="/"> <div> <h2 class="mb-4">Krok 1</h2> <div class="grid grid-columns-1 grid-gap-8"> <label class="font-bold" for="name">Imię* <input class="mt-2 w-full" type="text" name="name" id="name"> </label> <label class="font-bold" for="second_name">Nazwisko* <input class="mt-2 w-full" type="text" name="second_name" id="second_name"> </label> </div> </div> </form> </div> <div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8"> <img src="{{ asset('images/Vue.jpg') }}" alt=""> </div> </div> </div> </div>
  • 14. #9 - Blade + Design <div class="border border-grey p-4 text-right mb-8 lg:mb-0"> <button class="btn btn--black mr-4 w-24">Powrót</button> <button class="btn btn--green w-24">Dalej</button> <button class="btn btn--red w-24">Wyślij</button> </div>
  • 15. #9 - Blade + Design <ul class="steps flex items-center justify-center flex-col mb-8 lg:mb-0 h-screen/2"> <li class="step line done cursor-pointer"><span>1</span></li> <li class="step line active"><span>2</span></li> <li class="step pointer-events-none"><span>3</span></li> </ul>
  • 16. #9 - Blade + Design <div class="lg:mr-auto lg:ml-8"> <form action="/"> <div> <h2 class="mb-4">Krok 1</h2> <div class="grid grid-columns-1 grid-gap-8"> <label class="font-bold" for="name">Imię* <input class="mt-2 w-full" type="text" name="name" id="name"> </label> <label class="font-bold" for="second_name">Nazwisko* <input class="mt-2 w-full" type="text" name="second_name" id="second_name"> </label> </div> </div> </form> </div>
  • 17. #10 Vue <- Blade <div class="container py-8" id="app"> <div class="w-full"> <div class="border border-grey p-4 text-right mb-8 lg:mb-0"> <button class="btn btn--black mr-4 w-24">Powrót</button> <button class="btn btn--green w-24">Dalej</button> <button class="btn btn--red w-24">Wyślij</button> </div> <div class="flex flex-col lg:flex-row items-center w-full justify-between lg:py-8"> <ul class="steps flex items-center justify-center flex-col mb-8 lg:mb-0 h-screen/2"> <li class="step line done cursor-pointer"><span>1</span></li> <li class="step line active"><span>2</span></li> <li class="step pointer-events-none"><span>3</span></li> </ul> <div class="lg:mr-auto lg:ml-8"> <form action="/"> <div> <h2 class="mb-4">Krok 1</h2> <div class="grid grid-columns-1 grid-gap-8"> <label class="font-bold" for="name">Imię* <input class="mt-2 w-full" type="text" name="name" id="name"> </label> <label class="font-bold" for="second_name">Nazwisko* <input class="mt-2 w-full" type="text" name="second_name" id="second_name"> </label> </div> </div> </form> </div> <div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8"> <img src="{{ asset('images/Vue.jpg') }}" alt=""> </div> </div> </div> </div> <div class="container py-8" id="app"> <stepper-parent> <div class="lg:mr-auto lg:ml-8"> <form action="/"> <stepper-form :active="true"> @include('form.form1') </stepper-form> <stepper-form> @include('form.form2') </stepper-form> <stepper-form> @include('form.form3') </stepper-form> </form> </div> <div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8"> <img src="{{ asset('images/Vue.jpg') }}" alt=""> </div> </stepper-parent> </div>
  • 18. #11 Using slot <template> <div class="w-full"> <div class="border border-grey p-4 text-right mb-8 lg:mb-0" <button class="btn btn--black mr-4 w-24">Powrót</butto <button class="btn btn--green w-24">Dalej</button> <button class="btn btn--red w-24">Wyślij</button> </div> <div class="flex flex-col lg:flex-row items-center w-full justify-between lg:py-8"> <ul class="steps flex items-center justify-center flex-col m lg:mb-0 h-screen/2"> <li class="step line done cursor-pointer"><span>1</sp <li class="step line active"><span>2</span></li> <li class="step pointer-events-none"><span>3</span> </ul> <slot></slot> </div> </div> </template> <div class="container py-8" id="app"> <stepper-parent> <div class="lg:mr-auto lg:ml-8"> <form action="/"> <stepper-form :active="true"> @include('form.form1') </stepper-form> <stepper-form> @include('form.form2') </stepper-form> <stepper-form> @include('form.form3') </stepper-form> </form> </div> <div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8"> <img src="{{ asset('images/Vue.jpg') }}" alt=""> </div> </stepper-parent> </div>
  • 20. #12 - https://baianat.github.io/vee-validate/ <h2 class="mb-4">Krok 1</h2> <div class="grid grid-columns-1 grid-gap-8"> <label class="font-bold" for="name">Imię* <input v-validate="'required'" class="mt-2 w-full" v-model="form.name" type="text" name="name" id="name"> <p v-show="errors.has('name')" class="text-green text-xs mt-2 md:absolute">@{{ errors.first('name') }}</p> </label> <label class="font-bold" for="second_name">Nazwisko* <input v-validate="'required'" class="mt-2 w-full" v-model="form.secondName" type="text" name="second_name" id="second_name"> <p v-show="errors.has('second_name')" class="text-green text-xs mt-2 md:absolute">@{{ errors.first('second_name') }}</p> </label> </div>
  • 21. #13 - [stepper-form] init empty <template> <div> <slot></slot> </div> </template> <div class="container py-8" id="app"> <stepper-parent> <div class="lg:mr-auto lg:ml-8"> <form action="/"> <stepper-form :active="true"> @include('form.form1') </stepper-form> <stepper-form> @include('form.form2') </stepper-form> <stepper-form> @include('form.form3') </stepper-form> </form> </div> <div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8"> <img src="{{ asset('images/Vue.jpg') }}" alt=""> </div> </stepper-parent> </div>
  • 22. #14 - [app.js] init components require('./bootstrap'); window.Vue = require('vue'); Vue.component('stepper-parent', require('./components/StepperParent.vue')); Vue.component('stepper-form', require('./components/StepperForm.vue')); import VeeValidate from 'vee-validate'; Vue.use(VeeValidate); const app = new Vue({ data: { form: {}, }, el: '#app' });
  • 23.
  • 24. #15 - [stepper-form] displaying steps <template> <transition name="slide" mode="in-out"> <div v-if="isActive"> <slot></slot> </div> </transition> </template> <script> export default { props: { active: { default: false, type: Boolean, } },
  • 25. #15 - [stepper-form] displaying steps data() { return { isActive: false, } }, methods: { open() { this.isActive = true; }, close() { this.isActive = false; }, toggle() { return this.isActive ? this.close() : this.open(); } }, mounted() { if (this.active) { this.open(); } } } </script>
  • 26. #16 - Animations <style> .slide-enter-active, .slide-leave-active { transition: all .5s; } .slide-enter, .slide-leave-to { opacity: 0; height: 0; transform: translateX(100px) scale(0.1) rotate(-15deg); } .fade-enter-active, .fade-leave-active { transition: opacity .5s; } .fade-enter, .fade-leave-to { opacity: 0; } </style>
  • 27.
  • 28. #17 - [stepper-parent] init data data() { return { totalSteps: 0, actualStep: 1, validated: 1, } }, mounted() { this.totalSteps = this.$children.length; }
  • 30. #17 - [stepper-parent] dynamic steps <li v-for="step in totalSteps" :key="step" class="step" @click="goToStep(step)" :class="{ active: step === actualStep, line: step < totalSteps, 'done cursor-pointer': step < actualStep || step <= validated, 'pointer-events-none': step > validated }"> <span>{{ step }}</span> </li> <ul class="steps flex items-center justify-center flex-col mb-8 lg:mb-0 h-screen/2"> <li class="step line done cursor-pointer"><span>1</span></li> <li class="step line active"><span>2</span></li> <li class="step pointer-events-none"><span>3</span></li> </ul>
  • 31. Aby odtworzyć film kliknij tutaj
  • 32. #18 - [stepper-parent] dynamic buttons <transition name="fade" mode="in-out"> <button v-show="actualStep !== 1" class="btn btn--black mr-4 w-24" @click="backStep">Powrót</button> </transition> <button :class="{'btn--green': actualStep < totalSteps, 'btn--red': actualStep === totalSteps,}" class="btn w-24" @click="nextButtonAction"> {{ actualStep < totalSteps ? 'Dalej' : 'Wyślij' }} </button>
  • 33. #19 - [stepper-parent] next prev logic nextStep() { this.goToStep(this.actualStep + 1); if (this.actualStep > this.validated) { this.validated++; } }, backStep() { this.goToStep(this.actualStep - 1); }, goToStep(step) { this.$children[this.actualStep - 1].close(); this.actualStep = step; let $this = this; setTimeout(function () { $this.$children[$this.actualStep - 1].open(); }, 500); },
  • 34. #19 - [stepper-parent] next prev logic nextButtonAction() { this.$parent.$validator.validate().then(result => { if (!result) { // invalid return null; } else { // valid if (this.actualStep < this.totalSteps) { return this.nextStep(); } else { return this.submit(); } } }); }, submit() { alert(JSON.stringify(this.$parent.form, null, 4)); },
  • 35. Aby odtworzyć film kliknij tutaj
  • 36. Aby odtworzyć film kliknij tutaj
  • 37. #20 - v-cloak <stepper-parent> <div class="lg:mr-auto lg:ml-8" v-cloak> <form action="/"> <stepper-form :active="true"> @include('form.form1') </stepper-form> <stepper-form> @include('form.form2') </stepper-form> <stepper-form> @include('form.form3') </stepper-form> </form> </div> <div class="mb-8 lg:mb-0 lg:w-64 lg:ml-8"> <img src="{{ asset('images/Vue.jpg') }}" alt=""> </div> </stepper-parent> [v-cloak] { display: none; }
  • 38. Aby odtworzyć film kliknij tutaj