<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rizwan Liaqat on Medium]]></title>
        <description><![CDATA[Stories by Rizwan Liaqat on Medium]]></description>
        <link>https://medium.com/@rizubutt906?source=rss-af04c6d205fd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KqevohCmd5Y-zc_0KDsyoA.jpeg</url>
            <title>Stories by Rizwan Liaqat on Medium</title>
            <link>https://medium.com/@rizubutt906?source=rss-af04c6d205fd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 05:57:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rizubutt906/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Handling Events With Vue.js]]></title>
            <link>https://medium.com/@rizubutt906/handling-events-with-vue-js-78ab4e391969?source=rss-af04c6d205fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/78ab4e391969</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[single-page-applications]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Rizwan Liaqat]]></dc:creator>
            <pubDate>Thu, 30 Nov 2017 14:10:54 GMT</pubDate>
            <atom:updated>2017-11-30T14:11:28.212Z</atom:updated>
            <content:encoded><![CDATA[<p>Vue.js allows us to handle events triggered by the user. Handling events helps add interactivity to web apps by responding to the user’s input. Vue provides us with the v-on directive to handle these events.</p><p>User interactions with the view can trigger events on the DOM such as click and keyup. We can use the v-on directive to handle these events.</p><p>As a simple example, we can implement a counter that increments every time a user clicks a button. Let’s start off by initializing a counter to zero in the data model:</p><pre>data() {<br>  return {<br>    count: 0<br>  }<br>}</pre><p>In the view, we can define the method to run when a button is clicked:</p><pre>&lt;label&gt;Count is: {{count}}&lt;/label&gt;<br>&lt;button v-on:click=&quot;count++&quot;&gt;+&lt;/button&gt;</pre><p>v-on will trigger the expression or the method specified when the click event in triggered on the button element.</p><p>In this example, it would increment the count value by one.</p><h3>Binding methods to v-on</h3><p>We can bind methods to events using their names.</p><pre>&lt;button v-on:click=&quot;addToCount&quot;&gt;Add&lt;/button&gt;</pre><p>The method addToCount specified in the template can be defined in the model as follows.</p><pre>methods: {<br>  addToCount: function() {<br>    this.count++;<br>  }<br>}</pre><h3>Shorthand for v-on</h3><p>Rather than having to declare events using the v-on: syntax, we can use the @ symbol instead:</p><pre>&lt;button @click=&quot;addToCount&quot;&gt;+&lt;/button&gt;</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FLiaqat%2Fembed%2Fpreview%2FdZQwZN%3Fheight%3D600%26slug-hash%3DdZQwZN%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2FLiaqat%2Fpen%2FdZQwZN&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F1616977.dZQwZN.small.b6f5d4d4-bd64-4d09-b821-9f90628d2303.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/8647cd8f9bfb7820a80288b54a51c5fd/href">https://medium.com/media/8647cd8f9bfb7820a80288b54a51c5fd/href</a></iframe><h3>Event Modifiers</h3><p>There are frequently used calls that are made when handling events. Vue has made it easier for us to implement these by using modifiers.</p><p>For example, event.preventDefault() is often called when handling events to prevent the browsers default behavior.</p><p>Instead of having to write these out in the methods, we can use the modifiers provided with the vue-on directive.</p><pre>&lt;a href=&quot;test&quot; @click.prevent=&quot;addToCount&quot;&gt;Add&lt;/a&gt;</pre><p>The above code sample would remove the default behavior of the a tag and just call the addToCount method. If we didn’t add the modifier, the page would try to re-direct to the path defined in the href attribute.</p><p>The following modifiers are available in Vue.</p><ul><li>stop — Prevents event bubbling up the DOM tree</li><li>prevent — Prevents default behavior</li><li>capture — Capture mode is used for event handling</li><li>self — Only trigger if the target of the event is itself</li><li>once — Run the function at most once</li></ul><h3>Key Modifiers</h3><p>Similar to event modifiers, we can add key modifiers that allow us to listen to a particular key when handling key-related events such as keyup.</p><pre>&lt;input v-on:keyup.13=&quot;addToCount&quot; v-model=&quot;addValue&quot;&gt;</pre><p>In the above example, when the keyup event is fired with the key code of 13 (the enter key), the addToCount method gets called.</p><p>Since it’s difficult to remember all of the key codes, Vue provides a set of pre-defined keys. Some examples are enter, tab, delete, esc, space and left.</p><p>Also, it’s possible to setup your own alias for key codes as follows:</p><pre>Vue.config.keyCodes.a = 65</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78ab4e391969" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Filters in Vue.js]]></title>
            <link>https://medium.com/@rizubutt906/filters-in-vue-js-e041ce45fc72?source=rss-af04c6d205fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/e041ce45fc72</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[sap]]></category>
            <category><![CDATA[single-page-applications]]></category>
            <dc:creator><![CDATA[Rizwan Liaqat]]></dc:creator>
            <pubDate>Thu, 30 Nov 2017 13:29:15 GMT</pubDate>
            <atom:updated>2017-11-30T19:55:47.621Z</atom:updated>
            <content:encoded><![CDATA[<p>Filters are an interesting way to deal with data rendering in Vue but are only useful in a small amount of cases. The first thing to understand about filters is that they aren’t replacements for methods, computed values, or watchers, because <strong>filters don’t transform the data, just the output that the user sees</strong>.</p><pre>{{ name | uppercase }}</pre><p>The filters lowercase and capitalize can be used in a similar manner.</p><h3>Custom Filters</h3><p>You can create your own filters as well. We can use filters locally or globally, but it’s worth mentioning that if you declare a Vue filter globally it should come before the Vue instance. In both cases, we would pass the value in as a parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*1DIUOoeBawf8PabyeKV9xQ.png" /><figcaption>global and local filter syntax</figcaption></figure><p>Here’s a small example, with a tip calculator:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*HM7qbKBe518WtHFJLi6ekQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*cisiYY5gszCgjZusLu4_rg.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FLiaqat%2Fembed%2Fpreview%2FOOadLB%3Fheight%3D600%26slug-hash%3DOOadLB%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2FLiaqat%2Fpen%2FOOadLB&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/56388bb630906245d7aa0e13070bcc3c/href">https://medium.com/media/56388bb630906245d7aa0e13070bcc3c/href</a></iframe><h3>Chaining Filters</h3><p>Filters can also be chained. Keep in mind if you’re going to chain filters: ordering matters. The first filter will be applied first, the second will be applied to the completed first, and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*5aTmV4CFBfVTplXKjUhzQQ.png" /></figure><p>We can also pass additional arguments into filters like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*FX75F1rpoUy6lT6abSSmgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*BPW5h8cst81ZdOkBk4Za7w.png" /></figure><h3>Conclusion</h3><p>Now, you might think, based on the name, that filters would be great for forms when we want to show only some bits of data and not others. However, filters need to rerun on every single update, so if you have something like an input that updates every time you type, it’s not very performant. Better to use <strong>computed</strong> for something like this as it&#39;s less overhead. The results will be cached based on their dependencies and won&#39;t be rerun on every update. Computed properties will only be reevaluated when those dependencies change, but can also handle complex logic. This makes them excellent candidates for filtering information based on input. There are, however, circumstances where you do need to update based on changes in time, and for these instances, better to use a <strong>method</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e041ce45fc72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Vue.js]]></title>
            <link>https://medium.com/@rizubutt906/introduction-to-vue-js-d7c9e31fd149?source=rss-af04c6d205fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7c9e31fd149</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[sap]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Rizwan Liaqat]]></dc:creator>
            <pubDate>Thu, 30 Nov 2017 12:13:24 GMT</pubDate>
            <atom:updated>2017-11-30T13:03:10.635Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="http://vuejs.org/">Vue.js</a> is a JavaScript library that helps you build web applications using the MVVM Architectural pattern. At first glance, it might seem quite similar to <a href="https://angularjs.org/">AngularJS</a>, but once you start working with it you’ll quickly realize that Vue.js is not only much simpler and easier to learn, but also more flexible.</p><h3>Adding Vue.js to Your Page</h3><pre>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js&quot;&gt;<br>&lt;/script&gt;</pre><h3>Creating a View-Model</h3><p>In Vue.js, view-models are created using the Vue class. If you are wondering what a view-model is, you can think of it as an object that makes it very easy for you to display your model’s data inside a view (you can treat any object literal as a model, and any HTML UI element as a view).</p><p>To see how a view-model works, let’s start by creating a view. An empty &lt;div&gt; will do for now:</p><pre>&lt;div id=&quot;my_view&quot;&gt;<br>&lt;/div&gt;</pre><p>And here’s an object literal which will be our model. As it deals with JavaScript code, make sure you create it inside a &lt;script&gt; tag, or in a separate JS file.</p><pre>var myModel = {<br>  name: &quot;Rizwan&quot;,<br>  age: 23<br>};</pre><p>Now that we have a view and a model, it’s time to create a view-model (a Vueinstance) that binds both together:</p><pre>var myViewModel = new Vue({<br>  el: &#39;#my_view&#39;,<br>  data: myModel<br>});</pre><p>As you can see, the el property points to the view (you can use any CSS selector here), and the data property points to the model. Our view-model is now ready to be used.</p><p>To display your model’s data inside the view, you should use mustache-style bindings. For example, to display the age property of your model you would add the string {{age }} inside your view. The following code snippet uses both the properties of the model:</p><pre>&lt;div id=&quot;my_view&quot;&gt;<br>  {{ name }} is {{ age }} years old.<br>  &lt;!-- Evaluated to &quot;Rizwan is 22 years old&quot; --&gt;<br>&lt;/div&gt;</pre><p>Any changes you make to your model will be instantly visible in the view.</p><h3>Creating Two-Way Bindings</h3><p>If you want to allow the view to edit the model you should create a two-way binding instead, using the v-model directive.</p><p>Let’s change our view so that it contains an input element whose v-model points to the name property:</p><pre>&lt;div id=&quot;my_view&quot;&gt;<br>  &lt;label for=&quot;name&quot;&gt;Enter name:&lt;/label&gt;<br>  &lt;input type=&quot;text&quot; v-model=&quot;name&quot; id=&quot;name&quot; name=&quot;name&quot; /&gt;<br>  &lt;p&gt;{{ name }} is {{ age }} years old.&lt;/p&gt;<br>&lt;/div&gt;</pre><p>At this point, if you edit the value in the input field, your model will change immediately. For convenience, I have used code pen editor.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FLiaqat%2Fembed%2Fpreview%2FpdQQwd%3Fheight%3D600%26slug-hash%3DpdQQwd%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2FLiaqat%2Fpen%2FpdQQwd&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F1616977.pdQQwd.small.49bffc90-33d8-42e9-9def-43bbfe8173cc.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/6da9c8bc8598bc90936831003fe63434/href">https://medium.com/media/6da9c8bc8598bc90936831003fe63434/href</a></iframe><h3>Conclusion</h3><p>In this introductory tutorial about Vue.js we have looked at how to use one-way and two-way data binding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7c9e31fd149" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>