The presentation slide for Vue.js meetup
http://abeja-innovation-meetup.connpass.com/event/38214/
That contains mainly about SSR (Server side rendering) + SPA with isomorphic fetch and client hydration
Reviews the basis of using JavaScript within WordPress. How to load in scripts correctly and move PHP data into JavaScripts for later use. Presented at WordCamp LA 2012
Gutenberg sous le capot, modules réutilisablesRiad Benguella
Gutenberg arrive, ça change tout pour ce qui est de la création de contenu dans WordPress. Mais ce que vous ne savez pas c’est que Gutenberg a le potentiel pour changer beaucoup de choses pour les développeurs de plugins et de thèmes WordPress et même à l’extérieur de la communauté WordPress.
De la gestion des données de votre plugin, la gestion des dates, l’internationalisation à l’interface UI, Gutenberg est une mine d’or qui ne demande qu’à être exploitée. Explorons ensemble l’architecture modulaire de Gutenberg et apprenons à réutiliser ses modules pour ses propres projets.
The presentation slide for Vue.js meetup
http://abeja-innovation-meetup.connpass.com/event/38214/
That contains mainly about SSR (Server side rendering) + SPA with isomorphic fetch and client hydration
Reviews the basis of using JavaScript within WordPress. How to load in scripts correctly and move PHP data into JavaScripts for later use. Presented at WordCamp LA 2012
Gutenberg sous le capot, modules réutilisablesRiad Benguella
Gutenberg arrive, ça change tout pour ce qui est de la création de contenu dans WordPress. Mais ce que vous ne savez pas c’est que Gutenberg a le potentiel pour changer beaucoup de choses pour les développeurs de plugins et de thèmes WordPress et même à l’extérieur de la communauté WordPress.
De la gestion des données de votre plugin, la gestion des dates, l’internationalisation à l’interface UI, Gutenberg est une mine d’or qui ne demande qu’à être exploitée. Explorons ensemble l’architecture modulaire de Gutenberg et apprenons à réutiliser ses modules pour ses propres projets.
GWT as a compiler and SDK is well known web frontend technology for writing client applications with pure Java. Server driven frameworks such as Vaadin use GWT based thin client to automate data transportation and view rendering for client browsers.
How does Vaadin’s communication mechanism work internally with GWT and what kind of transportation techniques are used? How is the server side component state reflected to client side widget and what happens when there’s user interaction? What about Polymer and web components, how would we utilize them with Vaadin?
This session will establish a solid ground work for answering these questions and will tell you the most intriguing details on what really happens behind the scenes of the framework.
Opencast Admin UI - Introduction to developing using AngularJSbuttyx
This presentation is intended to help developers anticipating using and potentially extending the new Admin UI get a hands-on introduction into the Angular JS portion of the software. It has been presented in the form of a workshop and therefore the last slides (starting with the 22) could seem a bit abstract.
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)Igor Bronovskyy
09 - Express Nodes on the right Angle - Vitaliy Basyuk - IT Event 2013 (5)
60 вузлів під правильним кутом - миттєва розробка програмних додатків використовуючи Node.js + Express + MongoDB + AngularJS.
Коли ми беремось за новий продукт, передусім ми думаємо про пристрасть, яка необхідна йому, щоб зробити користувача задоволеним і відданим нашому баченню. А що допомагає нам здобути прихильність користувачів? Очевидно, що окрім самої ідеї, також важлими будуть: зручний користувацький інтерфейс, взаємодія в реальному часі та прозора робота з даними. Ці три властивості ми можемо здобути використовучи ті чи інші засоби, проте, коли все лиш починається, набагато зручніше, якщо інструменти допомагають втілити бажане, а не відволікають від головної мети.
Ми розглянемо процес розробки, використовуючи Node.js, Express, MongoDB та AngularJS як найбільш корисного поєднання для отримання вагомої переваги вже на старті вашого продукту.
Віталій Басюк
http://itevent.if.ua/lecture/express-nodes-right-angle-rapid-application-development-using-nodejs-express-mongodb-angular
28.03.15. Одесса. Impact Hub Odessa. Конференция JSLab.
Алексей Волков. "React на практике"
Доклад освещает практические аспекты использования React.js в различном окружении. React и модели Backbone. React и таблицы стилей, а также React в мобильном вебе. Будет полезно как и тем, кто только интересуется этой библиотекой, а также опытным разработчикам.
Подробнее:
http://geekslab.co/
https://www.facebook.com/GeeksLab.co
https://www.youtube.com/user/GeeksLabVideo
A presentation made for the NG-CONF Israel that took place in jun 2014 at Google TLV Campus (http://ng-conf.gdg.co.il/)
its an overview of how to use ngRoute and UI-Router in your app this slideshow contain a link for a working demo
Dethroning Grunt: Simple and Effective Builds with gulp.jsJay Harris
Grunt is king. It is the ubiquitous task runner used for most nodejs projects and has quickly expanded to conquer other software ecosystems. However, its kingdom is vulnerable. Grunt does not align well with many nodejs paradigms and is notorious for its harsh learning curve. Meet Gulp, the challenger in the taskrunner revolution. Gulp’s easy configuration produces an easy learning curve, and its alignment with nodejs paradigms eliminates the friction. Grab your ticket, your foam finger, and your team-colored face paint and witness the battle, the revolution, and the crowning of Gulp.
Caching is one of the most popular ways to optimize the performance of web applications. Magento is not far from this trend and the primary approach to speed up slow code from the core team is to cache it. This approach works well for small projects where the rate of inventory changes is shallow. But as soon as you enter sales season or receive regular product updates from the external system, your cache hit ratio plummets. In this talk, you will learn how to ensure that your system’s uncached response times are as light as possible when you get a cache miss by minimizing the I/O of your application with intelligent batch data preloading.
A quick overview of tips, tricks and code snippets for developers using Symfony and all its ecosystem, from Monolog to Doctrine. Learn how to become more productive and discover some rarely used options and features.
Refactoring Large Web Applications with Backbone.jsStacy London
Have you ever starting working on a large, existing web application and jQuery spaghetti-code is all over the place? Your mind swirls as you try to figure out what code belongs to what component on what page. There are no JavaScript unit tests and you're terrified of making a change and breaking everything? I'm going to talk through the real life story of how Backbone.js helped to bring organization/structure, modularity, and testability to a large multi-page web application.
GWT as a compiler and SDK is well known web frontend technology for writing client applications with pure Java. Server driven frameworks such as Vaadin use GWT based thin client to automate data transportation and view rendering for client browsers.
How does Vaadin’s communication mechanism work internally with GWT and what kind of transportation techniques are used? How is the server side component state reflected to client side widget and what happens when there’s user interaction? What about Polymer and web components, how would we utilize them with Vaadin?
This session will establish a solid ground work for answering these questions and will tell you the most intriguing details on what really happens behind the scenes of the framework.
Opencast Admin UI - Introduction to developing using AngularJSbuttyx
This presentation is intended to help developers anticipating using and potentially extending the new Admin UI get a hands-on introduction into the Angular JS portion of the software. It has been presented in the form of a workshop and therefore the last slides (starting with the 22) could seem a bit abstract.
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)Igor Bronovskyy
09 - Express Nodes on the right Angle - Vitaliy Basyuk - IT Event 2013 (5)
60 вузлів під правильним кутом - миттєва розробка програмних додатків використовуючи Node.js + Express + MongoDB + AngularJS.
Коли ми беремось за новий продукт, передусім ми думаємо про пристрасть, яка необхідна йому, щоб зробити користувача задоволеним і відданим нашому баченню. А що допомагає нам здобути прихильність користувачів? Очевидно, що окрім самої ідеї, також важлими будуть: зручний користувацький інтерфейс, взаємодія в реальному часі та прозора робота з даними. Ці три властивості ми можемо здобути використовучи ті чи інші засоби, проте, коли все лиш починається, набагато зручніше, якщо інструменти допомагають втілити бажане, а не відволікають від головної мети.
Ми розглянемо процес розробки, використовуючи Node.js, Express, MongoDB та AngularJS як найбільш корисного поєднання для отримання вагомої переваги вже на старті вашого продукту.
Віталій Басюк
http://itevent.if.ua/lecture/express-nodes-right-angle-rapid-application-development-using-nodejs-express-mongodb-angular
28.03.15. Одесса. Impact Hub Odessa. Конференция JSLab.
Алексей Волков. "React на практике"
Доклад освещает практические аспекты использования React.js в различном окружении. React и модели Backbone. React и таблицы стилей, а также React в мобильном вебе. Будет полезно как и тем, кто только интересуется этой библиотекой, а также опытным разработчикам.
Подробнее:
http://geekslab.co/
https://www.facebook.com/GeeksLab.co
https://www.youtube.com/user/GeeksLabVideo
A presentation made for the NG-CONF Israel that took place in jun 2014 at Google TLV Campus (http://ng-conf.gdg.co.il/)
its an overview of how to use ngRoute and UI-Router in your app this slideshow contain a link for a working demo
Dethroning Grunt: Simple and Effective Builds with gulp.jsJay Harris
Grunt is king. It is the ubiquitous task runner used for most nodejs projects and has quickly expanded to conquer other software ecosystems. However, its kingdom is vulnerable. Grunt does not align well with many nodejs paradigms and is notorious for its harsh learning curve. Meet Gulp, the challenger in the taskrunner revolution. Gulp’s easy configuration produces an easy learning curve, and its alignment with nodejs paradigms eliminates the friction. Grab your ticket, your foam finger, and your team-colored face paint and witness the battle, the revolution, and the crowning of Gulp.
Caching is one of the most popular ways to optimize the performance of web applications. Magento is not far from this trend and the primary approach to speed up slow code from the core team is to cache it. This approach works well for small projects where the rate of inventory changes is shallow. But as soon as you enter sales season or receive regular product updates from the external system, your cache hit ratio plummets. In this talk, you will learn how to ensure that your system’s uncached response times are as light as possible when you get a cache miss by minimizing the I/O of your application with intelligent batch data preloading.
A quick overview of tips, tricks and code snippets for developers using Symfony and all its ecosystem, from Monolog to Doctrine. Learn how to become more productive and discover some rarely used options and features.
Refactoring Large Web Applications with Backbone.jsStacy London
Have you ever starting working on a large, existing web application and jQuery spaghetti-code is all over the place? Your mind swirls as you try to figure out what code belongs to what component on what page. There are no JavaScript unit tests and you're terrified of making a change and breaking everything? I'm going to talk through the real life story of how Backbone.js helped to bring organization/structure, modularity, and testability to a large multi-page web application.
Aman Mishra from TO THE NEW walks through Vue.Js. It gives an introduction about Vue.js, popularity, size comparison, template syntax, the importance of Vue.js and much more.
In a world dominated by React and Angular, Vue is the open source framework that brings a third alternative to the table, combining the strengths of the first two while trying to weed out their weaknesses.
The result is an easy to use, lightweight and versatile framework. In this talk we will explore Vue's architecture, see how components interact among themselves, have a look at the event model and in the end, how to wrap everything together in a SPA using Webpack.
Creating GUI container components in Angular and Web ComponentsRachael L Moore
So you've embraced architecting your Angular application with reusable components--cheers to you! But you have UI components that need multiple entry points for user markup, and regular ng-transclude left you hanging. In this talk, we'll cover how new web component standards, like the Shadow DOM, handle this. Next, we'll walk through how to accomplish it today in Angular 1.3 -- and also give you a brief glimpse into what a solution will look like in upcoming Angular 2. Afterwards, you'll know how to make layout scaffold components with custom elements that serve as containers for arbitrary user-provided HTML content.
Talk presented at ng-conf in March 2015.
Do you hear of Vue.js everywhere lately? With this presentation, you will be able to create your first app in just 30 minutes. Understand the basics and get yourself a solid knowledge to start your journey with the new progressive JavaScript Framework.
Webinar: AngularJS and the WordPress REST APIWP Engine
The WordPress REST API, in conjunction with a JavaScript MVC framework such as AngularJS, opens up endless opportunities for developers to build new types of plugins and customize user experiences. This webinar goes in-depth into how to use AngularJS with the WordPress REST API. Together, these tools help you tie systems together to customize user experiences, build plugins, and advance your business in new, innovative ways that are only limited by your imagination!
What is covered in these slides:
-How to make custom admin interfaces using REST API & Angular JS
-2 practical examples of specific use cases:
-Starting point - Simple example of creating a customized post editor with AngularJS.
-End point - Using AngularJS to build a plugin admin screen using Ingot A/B testing plugin as an example.
Webinar: AngularJS and the WordPress REST APIWP Engine UK
The WordPress REST API, in conjunction with a JavaScript MVC framework such as AngularJS, opens up endless opportunities for developers to build new types of plugins and customize user experiences. This webinar goes in-depth into how to use AngularJS with the WordPress REST API. Together, these tools help you tie systems together to customize user experiences, build plugins, and advance your business in new, innovative ways that are only limited by your imagination!
What is covered in these slides:
-How to make custom admin interfaces using REST API & Angular JS
-2 practical examples of specific use cases:
-Starting point - Simple example of creating a customized post editor with AngularJS.
-End point - Using AngularJS to build a plugin admin screen using Ingot A/B testing plugin as an example.
Zoom is a comprehensive platform designed to connect individuals and teams efficiently. With its user-friendly interface and powerful features, Zoom has become a go-to solution for virtual communication and collaboration. It offers a range of tools, including virtual meetings, team chat, VoIP phone systems, online whiteboards, and AI companions, to streamline workflows and enhance productivity.
Atelier - Innover avec l’IA Générative et les graphes de connaissancesNeo4j
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Allez au-delà du battage médiatique autour de l’IA et découvrez des techniques pratiques pour utiliser l’IA de manière responsable à travers les données de votre organisation. Explorez comment utiliser les graphes de connaissances pour augmenter la précision, la transparence et la capacité d’explication dans les systèmes d’IA générative. Vous partirez avec une expérience pratique combinant les relations entre les données et les LLM pour apporter du contexte spécifique à votre domaine et améliorer votre raisonnement.
Amenez votre ordinateur portable et nous vous guiderons sur la mise en place de votre propre pile d’IA générative, en vous fournissant des exemples pratiques et codés pour démarrer en quelques minutes.
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
Looking for a reliable mobile app development company in Noida? Look no further than Drona Infotech. We specialize in creating customized apps for your business needs.
Visit Us For : https://www.dronainfotech.com/mobile-application-development/
E-commerce Application Development Company.pdfHornet Dynamics
Your business can reach new heights with our assistance as we design solutions that are specifically appropriate for your goals and vision. Our eCommerce application solutions can digitally coordinate all retail operations processes to meet the demands of the marketplace while maintaining business continuity.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
Takashi Kobayashi and Hironori Washizaki, "SWEBOK Guide and Future of SE Education," First International Symposium on the Future of Software Engineering (FUSE), June 3-6, 2024, Okinawa, Japan
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
Launch Your Streaming Platforms in MinutesRoshan Dwivedi
The claim of launching a streaming platform in minutes might be a bit of an exaggeration, but there are services that can significantly streamline the process. Here's a breakdown:
Pros of Speedy Streaming Platform Launch Services:
No coding required: These services often use drag-and-drop interfaces or pre-built templates, eliminating the need for programming knowledge.
Faster setup: Compared to building from scratch, these platforms can get you up and running much quicker.
All-in-one solutions: Many services offer features like content management systems (CMS), video players, and monetization tools, reducing the need for multiple integrations.
Things to Consider:
Limited customization: These platforms may offer less flexibility in design and functionality compared to custom-built solutions.
Scalability: As your audience grows, you might need to upgrade to a more robust platform or encounter limitations with the "quick launch" option.
Features: Carefully evaluate which features are included and if they meet your specific needs (e.g., live streaming, subscription options).
Examples of Services for Launching Streaming Platforms:
Muvi [muvi com]
Uscreen [usencreen tv]
Alternatives to Consider:
Existing Streaming platforms: Platforms like YouTube or Twitch might be suitable for basic streaming needs, though monetization options might be limited.
Custom Development: While more time-consuming, custom development offers the most control and flexibility for your platform.
Overall, launching a streaming platform in minutes might not be entirely realistic, but these services can significantly speed up the process compared to building from scratch. Carefully consider your needs and budget when choosing the best option for you.
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeAftab Hussain
Understanding variable roles in code has been found to be helpful by students
in learning programming -- could variable roles help deep neural models in
performing coding tasks? We do an exploratory study.
- These are slides of the talk given at InteNSE'23: The 1st International Workshop on Interpretability and Robustness in Neural Software Engineering, co-located with the 45th International Conference on Software Engineering, ICSE 2023, Melbourne Australia
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
Graspan: A Big Data System for Big Code AnalysisAftab Hussain
We built a disk-based parallel graph system, Graspan, that uses a novel edge-pair centric computation model to compute dynamic transitive closures on very large program graphs.
We implement context-sensitive pointer/alias and dataflow analyses on Graspan. An evaluation of these analyses on large codebases such as Linux shows that their Graspan implementations scale to millions of lines of code and are much simpler than their original implementations.
These analyses were used to augment the existing checkers; these augmented checkers found 132 new NULL pointer bugs and 1308 unnecessary NULL tests in Linux 4.4.0-rc5, PostgreSQL 8.3.9, and Apache httpd 2.2.18.
- Accepted in ASPLOS ‘17, Xi’an, China.
- Featured in the tutorial, Systemized Program Analyses: A Big Data Perspective on Static Analysis Scalability, ASPLOS ‘17.
- Invited for presentation at SoCal PLS ‘16.
- Invited for poster presentation at PLDI SRC ‘16.
2. ● Created by Evan You - A former Google
employee
● Vue Introduced as “progressive frontend
framework”
● First released on Oct 2015
● Latest release is 2.5.x
5. Vue.js is declarative and reactive
<div id="app">
{{ message }}
</div>
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
}
})
<div id="app-2">
<span v-bind:title="message">
Hover your mouse over me for a few
seconds
to see my dynamically bound title!
</span>
</div>
var app2 = new Vue({
el: '#app-2',
data: {
message: 'You loaded this page on ' +
new Date().toLocaleString()
}
})
6. The Vue Instance
<div id="app">
{{ message }}
</div>
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
}
})
● Vue Components is a Vue instance
● Root component must declare the el option, which is the css selector of
the HTML element in the a page that will contain the Vue rendered
artifacts
● The Vue constructor get an options object which contains the component
configuration, some of the main configurations:
○ name
○ data
○ props
○ methods
○ computed
○ el
○ template
○ Lifecycle hooks
○ events
○ watch
○ ...
8. The Vue Component
Vue.component('button-counter', {
data: function () {
return {
count: 0
}
},
template: '<button v-on:click="count++">You clicked me {{ count
}} times.</button>'
})
<div id="components-demo">
<button-counter></button-counter>
<button-counter></button-counter>
<button-counter></button-counter>
</div>
● Components are reusable
Vue instances with a name
● The data option MUST be a
function (otherwise is will
affect ALL the instances of
the component)
● Components are organized in
a tree structure
9. template and directives
<span>Message: {{ msg }} </span>
<span>Message: {{ message. split('').reverse().join('') }}</span>
<p v-if="seen">Now you see me </p>
<a v-bind:href="url">Click me</a>
<a v-on:click="doSomething">Click me</a>
<form v-on:submit.prevent="onSubmit"></form>
<a :href="url">Click me</a>
<a @click="doSomething">Click me</a>
<a v-mycoolcustomdirective="cooldata">Click me</a>
● Based on the Mustache
syntax
● Common directives:
○ v-if
○ v-for
○ v-show
○ v-once
○ v-html
○ v-bind for data binding
(use : for shorthand)
○ v-on for events (use @
for shorthand)
● You can also implement your
own custom directives
10. Conditional Rendering
<div v-if="type === 'A'">
A
</div>
<div v-else-if="type === 'B'">
B
</div>
<div v-else-if="type === 'C'">
C
</div>
<div v-else>
Not A/B/C
</div>
<h1 v-show="ok">Hello!</h1>
● Use v-if directive for
conditional rendering
● Use v-else-if and v-else for
if-else logic
● Use v-show directive for
conditional visibility
● v-if will render the element
only if the condition is met,
v-show will render the
element anyway but will
toggle its visibility.
As a thumb rule it is better to
use v-if
Use v-show only for a reason.
e.g. the component state
should be preserved
11. List Rendering
<ul id="example-1">
<li v-for="item in items">
{{ item.message }}
</li>
</ul>
<div v-for="(value, key, index) in object">
{{ index }}. {{ key }}: {{ value }}
</div>
<ul id="v-for-object" class="demo">
<!--{firstName: 'John',lastName: 'Doe',age: 30}-->
<li v-for="value in object">
{{ value }}
</li>
</ul>
<div v-for="item in items" :key="item.id">
<!-- content -->
</div>
<!-- v-if will run for each v-for integration -->
<li v-for="item in items" v-if="item.exists">
<!-- content -->
</div>
● Use v-for directive for list
rendering
● Syntax is:
v-for="item in items"
Where items is the data
array and item is the
element alias
● As Vue uses the “in-place
patch” strategy it is best to
bind the key attribute with
unique key.
This will allow Vue to
optimize the list rendering
when reacting to data
changes
Starting 2.2.0 it is required for
looping over components
12. v-for and v-if
Bad:
<!-- v-if will run for each v-for integration -->
<li v-for="item in items" v-if="item.exists">
<!-- content -->
</li>
Good:
<ul v-if="items.length">
<li v-for="item in items">
<!-- content -->
</li>
</ul>
● v-for as higher priority than
v-if, meaning the v-if
calculation will take place for
each item on the list
● Optimize it by wrapping the
entire loop with v-if
13. Events
<div>
<button v-on:click= "counter += 1" >Add 1</button>
<p>The button above has been clicked {{ counter }} times.</p>
</div>
<div>
<!-- `greet` is the name of a method defined in the component -->
<button v-on:click= "greet">Greet</button>
</div>
<div>
<button @click= "say('hi')" >Say hi</button>
<button @click= "say('what')" >Say what</button>
</div>
<input v-on:keyup.enter= "submit">
this.$emit('myEvent')
<my-component v-on:my-event= "doSomething" ></my-component>
● Use v-on directive to listen to
DOM and custom events
● A listener can be both
method or inline handler
● Vue provides Event Modifiers
for handling a specific variant
of event (for instance: keyup
of the Enter key)
● A component may also emit a
custom event using the
this.$emit method - use the
name of the event in camel
case
● You can use @ as a
shorthand for Events
14. Data distribution: parent to child
Parent:
new Vue({
el: '#blog-post-demo',
data: {
posts: [
{ id: 1, title: 'My journey with Vue' },
{ id: 2, title: 'Blogging with Vue' },
{ id: 3, title: 'Why Vue is so fun' },
]
}
})
<blog-post
v-for="post in posts"
v-bind:key="post.id"
v-bind:title="post.title">
</blog-post>
● A parent component passes
the data to its child
component using props
● A component should declare
its own props
● props declaration has many
useful capabilities such as
type declaration, validators,
default value etc.
Component:
Vue.component('blog-post', {
props: {
title: {
type: String,
required: true,
}
},
template: '<h3>{{ title }}</h3>'
})
15. Data distribution: child to parent
Parent:
new Vue({
el: '#blog-post-demo',
data: {
posts: [...],
postFontSize: 1
},
methods: {
onEnlargeText: (enlargeAmount) => {
this.postFontSize += enlargeAmount
}
}
})
<div :style="{ fontSize: postFontSize + 'em' }">
<blog-post
v-for="post in posts"
v-bind:key="post.id"
v-bind:post="post"
v-on:enlarge-text="onEnlargeText">
</blog-post>
</div>
● Sometime we would like the child component to pass data to is parent - for this we will use Events
Component:
Vue.component('blog-post', {
props: {
post: {
type: Object,
required: true,
}
},
template: `
<div class="blog-post">
<h3>{{ post.title }}</h3>
<button
v-on:click="$emit('enlarge-text', 0.1)">
Enlarge text
</button>
<div v-html="post.content"></div>
</div>
`
})
16. Data distribution: v-model
● v-model is a directive that allows two way data binding for component
● v-model is automatically supported for components that implements the value prop and the input event
Native elements:
<input
v-bind:value="searchText"
v-on:input="searchText =
$event.target.value">
Is the same as:
<input v-model= "searchText" >
Custom elements:
Vue.component('custom-input', {
props: ['value'],
template: `
<input
v-bind:value="value"
v-on:input="$emit('input',
$event.target.value)">
`
})
Usage:
<custom-input v-model="searchText"></custom-input>
17. Slots
● Slots allows to inject free content into your component (text, html and other components)
Template of <navigation-link> component:
<a
v-bind:href="url"
class="nav-link">
<slot></slot>
</a>
Usage:
<navigation-link url="/profile">
Your Profile
</navigation-link>
<a href="/profile" class="nav-link">
Your Profile
</a>
Usage:
<navigation-link url="/profile">
<!-- Use a component to add an icon -->
<font-awesome-icon name="user"></font-awesome-icon>
Your Profile
</navigation-link>
<a href="/profile" class="nav-link">
<span class="fs fs-user"></span>
Your Profile
</a>
18. Named Slots
● Allows a component to have multiple slots
Template of <base-layout>
component:
<div class="container">
<header>
<slot name="header"></slot>
</header>
<main>
<slot></slot>
</main>
<footer>
<slot name="footer">Default
footer</slot>
</footer>
</div>
Usage 1:
<base-layout>
<template slot="header">
<h1>Here might be a page
title</h1>
</template>
<p>A paragraph for the main
content.</p>
<p>And another one.</p>
<template slot="footer">
<p>Here's some contact
info</p>
</template>
</base-layout>
Usage 2:
<base-layout>
<h1 slot="header">Here might
be a page title</h1>
<p>A paragraph for the main
content.</p>
<p>And another one.</p>
<p slot="footer">Here's some
contact info</p>
</base-layout>
19. Scope of the Slots
As the content of the slot is declared in the parent component - it
inherits the parent scope, for example:
In this example user if declared in the parent component and
navigation-link cannot access it.
But what if you do want to the slot to access the child component
data?
<navigation-link url="/profile" :class="user.class">
Logged in as {{ user.name }}
</navigation-link>
20. Scoped Slots
● Introduced on v2.1.0
● Scoped Slots allows to define the scope of the slot
Template of <todo-list> component:
<ul>
<li
v-for="todo in todos"
v-bind:key="todo.id">
<!-- passing the todo as slot
prop -->
<slot v-bind:todo="todo">
<!-- Fallback content -->
{{ todo.text }}
</slot>
</li>
</ul>
Usage:
<todo-list v-bind:todos="todos">
<!-- Define `slotProps` as the name of our slot scope -->
<template slot-scope="slotProps">
<!-- Define a custom template for todo items, using -->
<!-- `slotProps` to customize each todo. -->
<span v-if="slotProps.todo.isComplete">✓</span>
{{ slotProps.todo.text }}
</template>
</todo-list>
21. Dynamic Components
● Sometimes, it’s useful to
dynamically switch between
components
● In this example the content is
changes on the selected tabs
● currentTabComponent prop can
hold either the component name
or object
<!-- Component changes when currentTabComponent changes
-->
<component v-bind:is= "currentTabComponent" ></component>
22. Computed properties
<div id="example">
{{ message.split('').reverse().join('') }}
</div>
● Instead of using complex logic in the
template - use computed props
● they are considered as read only
properties of the component, therefore
you refer it as property, not as a
function ( no () )
● Computed props are cached - it will not
be re-evaluated if no dependency has
changed (as opposed to methods)
● Although computed props are enough
in most of the use cases, Vue offers
also a watch mechanism for handling
special cases.
<div id="example">
<p>Original message: "{{ message }}"</p>
<p>Computed reversed message: "{{ reversedMessage }}"</p>
</div>
var vm = new Vue({
el: '#example',
data: {
message: 'Hello'
},
computed: {
// a computed getter
reversedMessage: function () {
// `this` points to the vm instance
return this.message.split('').reverse().join('')
}
}
})
23. Reactivity rules
● Vue listen to changes only for properties
that were defined in the data option -
under the hoods it uses
Object.defineProperty for tracking
changes
● You cannot dynamically add properties to
data - declare empty placeholders for
future usage
● Vue cannot identify deep changes on data
- use Vue.set or re-assign the changes
property
var vm = new Vue({
data: {
// declare message with an empty value
message: ''
},
template: '<div>{{ message }}</div>'
})
vm.message = 'Hello!'
vm.message2 = 'Hello!' // not reactive
this.someObject.b = 2 // not recative
// following are recative
this.$set(this.someObject, 'b', 2) // alias of Vue.set
this.someObject = Object.assign({}, this.someObject, { a: 1, b: 2
})
25. Single File Components
● *.vue extension
● All the component assets are on the same
file - no jumping between template/js/css
files
● IDE plugins for syntax highlighting
● As the project got bigger it keeps it more
organized and reduce the amount of files
and layers.