<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Lisa Armstrong</title>
    <description>The latest articles on Forem by Lisa Armstrong (@workingwebsites).</description>
    <link>https://forem.com/workingwebsites</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F145299%2F4e217db2-5040-425f-93b7-7938e974a15a.png</url>
      <title>Forem: Lisa Armstrong</title>
      <link>https://forem.com/workingwebsites</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/workingwebsites"/>
    <language>en</language>
    <item>
      <title>I've Been Working from Home for Years, Here's Some Tips</title>
      <dc:creator>Lisa Armstrong</dc:creator>
      <pubDate>Wed, 18 Mar 2020 20:04:09 +0000</pubDate>
      <link>https://forem.com/workingwebsites/i-ve-been-working-from-home-for-years-here-s-some-tips-7p</link>
      <guid>https://forem.com/workingwebsites/i-ve-been-working-from-home-for-years-here-s-some-tips-7p</guid>
      <description>&lt;p&gt;Most of my career has been working from home / remotely. Overall, I love it, but it takes a while to adjust. It's a process, but here's what I figured out so far...&lt;/p&gt;

&lt;h2&gt;Know Yourself&lt;/h2&gt;

&lt;p&gt;The hardest thing is you're a manager to yourself -- and you can be a tricky employee. 😉 &lt;br&gt;Seriously, just be aware of what kind of worker you are and start with that. &lt;/p&gt;

&lt;p&gt;When are you most productive? What motivates you? How do you handle distractions, interruptions, boredom, being alone, stress?&lt;/p&gt;

&lt;p&gt;Time to be honest with yourself about yourself. No need to be critical, just figure out what kind of environment and schedule works for you and build on that.  &lt;/p&gt;

&lt;h2&gt;Boundaries Are Important!&lt;/h2&gt;

&lt;p&gt;The biggest danger of working from home is home life and work life can get mashed together.  As a result, you can feel like you're working &lt;em&gt;all&lt;/em&gt; the time -- and so does your family.  Having good boundaries with yourself, your company and your family keeps everyone happy.&lt;/p&gt;

&lt;p&gt;Figure out when and where you work.  What are your hours?  Make sure your work space feels separated from the rest of your home.  Even if your desk is in the middle of it all, during office hours, make sure it's an office, not a kitchen table.  When you're done work, put the computer away and turn it back into a place to live.&lt;/p&gt;

&lt;p&gt;Good boundaries need to be clear and consistent and enforced-- especially to yourself -- that's the hard part!&lt;/p&gt;

&lt;p&gt;When it's office hours, be at your 'desk' in work mode.  When work is done, walk away and be your home self again.  &lt;/p&gt;

&lt;p&gt;When you're clear about office hours and location, it makes it easier for those around you to know when and how to approach you.  Your employer can expect a response from you during these hours, your kids can expect a hug from you the rest of the time.&lt;/p&gt;

&lt;p&gt;Communicate this to all concerned and make sure you stick with it!&lt;/p&gt;

&lt;p&gt;It's also a healthier head space knowing you're done for the day.  If you get an idea after work, great!  Write it down, deal with it tomorrow at work.  You're done for the day.&lt;/p&gt;

&lt;h2&gt;Routine is Good&lt;/h2&gt;

&lt;p&gt;Figure out a routine that works for you, and stay with it!  &lt;/p&gt;

&lt;p&gt;Have a routine for going to work. Figure out what works for you and do it every day. Do something that helps you shift to 'work mode'.&lt;/p&gt;

&lt;p&gt;Routine at the end of the day is good too.  Be strict about quitting time, have a routine at the end.  Close the computer, turn off the light and go to the gym.  This is a way of changing gears so you don't stay in work-mode.&lt;/p&gt;

&lt;p&gt;I've found 'changing gears' is important, give yourself some time or routines to get in and out of work mode. In real life, it's the commute, you don't have that at home -- thankfully -- but do allow yourself some times to de-compress after a day at the office. &lt;/p&gt;

&lt;h2&gt;Exercise Keeps You Sane&lt;/h2&gt;

&lt;p&gt;Whether it's part of your morning or evening routine make sure you include exercise has part of your day. It's very easy to stay cooped up and not moving at all, and of course you know this isn't healthy.&lt;/p&gt;

&lt;p&gt;Don't be afraid to schedule a 'sanity walk' or 'sanity workout' during the work day and make it a priority.  Honestly, your productivity and mind-set will be better.  This doesn't mean you're goofing off, take a walk and make some calls, mull over something you're working on.  A good walk fixes a lot of problems!  &lt;/p&gt;

&lt;p&gt;Bonus points for getting out in nature.  It's a fact, being around the good earth is good for us, so get some fresh air if you can.&lt;/p&gt;

&lt;h2&gt;Communication is Oxygen&lt;/h2&gt;

&lt;p&gt;The big fear your clients / reports have with you working at home, is you're goofing off. They need to know you're working and -- most importantly -- see what you're doing.  This is why communication is so important with remote work -- like oxygen -- you die without it.&lt;/p&gt;

&lt;p&gt;Start your day with a check-in.  Tell your team you're in the office, what you're working on, goals and objectives for the day.  When the day is over, report what you got done, issues etc. and what you'll be doing the next day.&lt;/p&gt;

&lt;p&gt;This is also a good way to keep yourself focused on important taks and feeling like you've accomplished something.&lt;/p&gt;

&lt;p&gt;I like to make my work available to clients when I can.  They're welcome to have a look at a development site to see progress -- transparency is good.&lt;/p&gt;

&lt;p&gt;Remember:  It's not possible to over-communicate, so let the team know what you're doing all day.&lt;/p&gt;

&lt;h2&gt;Keeping Momentum&lt;/h2&gt;

&lt;p&gt;When you're done for the day, it's a good idea to jot down what you want to start with the next day.  That way when you come in, you got something to start with.  This keeps you focused on productive things.  &lt;/p&gt;

&lt;p&gt;Some days, well, you're just not into it, for whatever reason.  That's ok, you can't be a super hero every day.  Usually it's a good time to do the 'mindless task' and get caught up.  If you're finding there's a lot of these days, time your manager self has a talk with your worker self.  Maybe you need a change in routine?  Need some incentives to get going again?  Maybe it is time for a break.&lt;/p&gt;

&lt;p&gt;The trick here is to be honest with yourself about it.  Don't get side-tracked into house stuff, it will not help.  &lt;/p&gt;

&lt;p&gt;The other side of the equation is you're on a roll and want to keep working -- almost done, a couple of more hours!  That's great, but it's also the highway to burn out.  Sometimes pushing through makes sense, but mostly not.  Write down what you want to do next, then shut it down for the day.  This gives you something to look forward to tomorrow.&lt;/p&gt;

&lt;h2&gt;Be in the Real World&lt;/h2&gt;

&lt;p&gt;When your day is over, make it a point to spend time in the real world,  Talk to a real person, look at something that isn't on the screen, play with the dog.  You've been in your head all day, give it a rest and enjoy the physical world.  It keeps our balanced.&lt;/p&gt;

&lt;h2&gt;Setting Up Your Office&lt;/h2&gt;

&lt;p&gt;It's easy to fuss around with chairs and gadgets when you're setting up.  The important thing is make sure it works for you.  If working at home is a long term thing, create an office space that can be separate from the rest of your home.   Find a spot with natural light and a decent view -- good for the soul.&lt;/p&gt;

&lt;p&gt; Spend money on a good chair, set up your office so you can change position and move around.  I just put my monitor on an adjustable arm so I can move the screen -- life is better!&lt;/p&gt;

&lt;p&gt;Also, if your can move your office outside, it's worth it.  I like to work on the deck in the summer -- best corner office in the city IMHO.&lt;/p&gt;

&lt;p&gt;As for equipment, make sure it works, you don't need to fight with tech issues when you're trying to get stuff done. &lt;/p&gt;

&lt;h2&gt;It's a Process&lt;/h2&gt;

&lt;p&gt;You won't get it right the first time, it's a process.  Things change, you need to adapt, you'll figure it out.  Even after all these years, I'm still working on it.&lt;/p&gt;

&lt;p&gt;Anyone else have some tips for making working at home easier&amp;gt;&lt;/p&gt;

</description>
      <category>remote</category>
      <category>work</category>
      <category>career</category>
      <category>distributedcompanies</category>
    </item>
    <item>
      <title>Using Vue in jQuery and JavaScript Sites</title>
      <dc:creator>Lisa Armstrong</dc:creator>
      <pubDate>Sun, 01 Mar 2020 02:13:40 +0000</pubDate>
      <link>https://forem.com/workingwebsites/using-vue-in-jquery-and-javascript-sites-1ib7</link>
      <guid>https://forem.com/workingwebsites/using-vue-in-jquery-and-javascript-sites-1ib7</guid>
      <description>&lt;p&gt;So you've got a legacy project on your desk. You know the type, from back in the day when jQuery was the go-to tool. Now that project needs an update and although jQuery is still a useful tool, you know doing the update would go a lot quicker in Vue. &lt;br&gt;Ok, let's be honest, you might be looking for an excuse to use Vue -- I won't tell. &lt;/p&gt;

&lt;p&gt;The problem is, while the changes are a good candidate for Vue, there's still the rest of the site in jQuery or vanilla JavaScript. You don't want to refactor the whole thing, but dang! Vue would be awfully handy in there. So the question is: &lt;br&gt;&lt;strong&gt;Can I use Vue in a jQuery or vanilla JavaScript site?&lt;/strong&gt;&lt;/p&gt;

&lt;p class="has-text-align-center"&gt;&lt;strong&gt;Yes you can.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;It's All JavaScript Anyway&lt;/h2&gt;

&lt;p&gt;Although jQuery and Vue are different, they both work with the DOM and use JavaScript.&lt;/p&gt;

&lt;p&gt;That means using them in the same file shouldn't be an issue. Think of them as running parallel to each other, like two lanes going the same way on a highway. &lt;/p&gt;

&lt;p&gt;In this tutorial, we're going to add Vue functionality to a simple jQuery page and show you how Vue and jQuery (and vanilla JavaScript) can work together in harmony.&lt;/p&gt;

&lt;p&gt;We're assuming you know jQuery / JavaScript well, and have worked with Vue.  It's nothing fancy, just basic concepts.&lt;/p&gt;

&lt;h2&gt;The Project&lt;/h2&gt;

&lt;p&gt;Let's say we're working with an HTML file where you make a selection and it uses jQuery to tell you what's been selected.&lt;/p&gt;

&lt;p&gt;This is a standard type of app where the user makes a choice and the code responds.  The HTML looks like this:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;!-- Load JQuery --&amp;gt;
    &amp;lt;script
  src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
  integrity="sha256-pasqAKBDmFT4eHoN2ndd6lN370kFiGUFyTiUHWhU7k8="
  crossorigin="anonymous"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script type="text/javascript"&amp;gt;
        function doFoodGroup(){
            //Returns what is selected
            var selected = $("input:radio[name ='food_group']:checked").val();
            alert('You selected: '+selected)
        }
    &amp;lt;/script&amp;gt;
    &amp;lt;style&amp;gt;
        .demoDiv{
            display: inline-block; 
            width: 49%;
            vertical-align: top;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;JQuery and Vue&amp;lt;/h1&amp;gt;
    &amp;lt;div class="demoDiv"&amp;gt;
        &amp;lt;h2&amp;gt;Select a Food Group:&amp;lt;/h2&amp;gt;
        &amp;lt;input type="radio" name="food_group" value="fruit" onclick="doFoodGroup()"&amp;gt; Fruit
        &amp;lt;br&amp;gt;
        &amp;lt;input type="radio" name="food_group" value="veggies" onclick="doFoodGroup()"&amp;gt; Veggie
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Adding functionality through Vue&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We're going to update the code, so when a user makes a selection,  their choice is displayed on the page.   We're going to use Vue to code this, so let's load it.&lt;/p&gt;

&lt;h2&gt;Adding Vue&lt;/h2&gt;

&lt;p&gt;To use Vue, you need 3 things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Load Vue in the page&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Build your Vue code&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Give it an element  on the page to work in&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's set it up:&lt;/p&gt;

&lt;p&gt;1. &lt;strong&gt;Add Vue&lt;/strong&gt; to the page through the &lt;strong&gt;header&lt;/strong&gt;:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;!-- Load Vue --&amp;gt;
    &amp;lt;script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;2. &lt;strong&gt;Create a file &lt;/strong&gt;with the Vue code in it, and &lt;strong&gt;load it &lt;/strong&gt;in the HTML header:&lt;/p&gt;

&lt;p&gt;The file called '&lt;strong&gt;vue_demo.js&lt;/strong&gt;'.  &lt;br&gt;It's going to list fruit and veggies, so it looks like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;var vue_choices = new Vue({
    el: '#app', //Attach to element id app
    data: {
        fruits: ["apples", "pears", "peaches", "cherries"], 
        veggies: ["lettuce", "peas", "carrots", "tomatoes"], 
    },
})&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now &lt;strong&gt;load the file&lt;/strong&gt; in the HTML header&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;!-- Load script file.  'defer' loads after body is generated --&amp;gt;
&amp;lt;script src="vue_demo.js" defer&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;3. Create a &lt;strong&gt;DIV&lt;/strong&gt; for Vue to use:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;!-- Div where Vue runs --&amp;gt;
&amp;lt;div id="app" class="demoDiv"&amp;gt;
&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Not much to see here, so &lt;strong&gt;add some code to display the list in the Vue div:&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;!-- Div where Vue runs --&amp;gt;
    &amp;lt;div id="app" class="demoDiv"&amp;gt;
        &amp;lt;div&amp;gt;
            &amp;lt;h3&amp;gt;Fruit choices:&amp;lt;/h3&amp;gt;
            &amp;lt;ul id="fruit_list" style="list-style-type: none"&amp;gt;
                &amp;lt;li v-for="fruit in fruits"&amp;gt;
                    &amp;lt;input type="radio" name="food_selected" v-bind:value="fruit"&amp;gt;{{ fruit }}
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;div&amp;gt;
            &amp;lt;h3&amp;gt;Veggie choices:&amp;lt;/h3&amp;gt;
            &amp;lt;ul id="fruit_list" style="list-style-type: none"&amp;gt;
                &amp;lt;li v-for="veggie in veggies"&amp;gt;
                    &amp;lt;input type="radio" name="food_selected" v-bind:value="veggie"&amp;gt;{{ veggie }}
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note: This is a list of radio options because we're selecting them later. &lt;/p&gt;

&lt;p&gt;When you look at the page, you should see jQuery 'Select a Food Group' div in one area and Vue's list of fruits and veggies next to it.  So, you &lt;em&gt;can&lt;/em&gt; have a Vue running in a page using jQuery -- problem solved!&lt;/p&gt;

&lt;p&gt;Of course in real life, you'll probably need Vue to interact with the rest of the page.  Data needs to go back and forth between Vue and JavaScript.  &lt;/p&gt;

&lt;p&gt;It's time to change lanes.  &lt;/p&gt;

&lt;h2&gt;Moving Between Vue and Javascript&lt;/h2&gt;

&lt;p&gt;Because Vue and Javascript are parallel, you can pass variables between them.  But, like changing lanes while driving, be careful you don't collide with something!&lt;/p&gt;

&lt;p&gt;When working with Vue and jQuery / JavaScript there's a couple of caveats to keep in mind:&lt;/p&gt;

&lt;h4&gt;1. Stay in Your Lane (When You Can)&lt;/h4&gt;

&lt;p&gt;Remember you've got two places to write your code -- DOM level JavaScript / jQuery or in Vue. It's easy to be on autopilot and start writing code in Vue, when it would really work better in DOM JavaScript.  The next thing you know, you're doing contortions trying to get something on the screen!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GOTCHA! Where you put your code matters&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If your code is &lt;em&gt;in&lt;/em&gt; Vue and you're trying to change a div &lt;em&gt;outside&lt;/em&gt; of the Vue div (or vice versa), you can run into problems.  Sure, there's ways around this, but it can be needlessly complicated.&lt;/p&gt;

&lt;p&gt;As a general rule:  &lt;strong&gt;Put your code where the element you're changing is&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you're changing something within the Vue div, then let Vue handle it.  &lt;/li&gt;
&lt;li&gt;If you're updating a div outside of the Vue div (in the document), then use the regular JavaScript to deal with it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In other words, stay in your lane (life will be easier).&lt;/p&gt;

&lt;h4&gt;2. Change Lanes Politely&lt;/h4&gt;

&lt;p&gt;Of course sooner or later you'll have to pass information from DOM JavaScript to Vue and back again.  You need to change lanes.&lt;/p&gt;

&lt;p&gt;When changing lanes while driving you make sure the other lane knows you're coming, and you behave predictably.  It's the same idea when passing a variable between DOM JavaScript and Vue.  Make sure the other side knows what's coming and can deal with it.&lt;/p&gt;

&lt;p&gt;As we're about to see, it's not a big trick and usually done through functions.&lt;/p&gt;

&lt;h2&gt;How To Pass Values to Vue&lt;/h2&gt;

&lt;p&gt;When you first look up how to pass a value to Vue, you probably found terms like: props, emit, components, parent/child. Do I need to build a component to pass data?&lt;/p&gt;

&lt;p&gt;Oh my, this feels complicated!&lt;br&gt;It's not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gotcha! You don't use components to pass parameters into Vue.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://vuejs.org/v2/guide/components.html" rel="noreferrer noopener"&gt;Components&lt;/a&gt; are great things &lt;em&gt;inside &lt;/em&gt;Vue. We're passing data from &lt;em&gt;outside&lt;/em&gt; Vue, so it doesn't apply. It's the wrong tool for the job -- it's actually simpler than that. &lt;/p&gt;

&lt;h3&gt;Remember: Vue is a Javascript Object!&lt;/h3&gt;

&lt;p&gt;When you loaded Vue, it became an object within Javascript. &lt;/p&gt;

&lt;p&gt;The code:  &lt;code&gt;var vue_choices = new Vue({ &lt;/code&gt;&lt;br&gt;means you've created an JavaScript object called 'vue_choices' in the document.  That means it's available to JavaScript in the document.  In fact, you can get see the vue_choices object through the console log in the DOM JavaScript.&lt;/p&gt;

&lt;p&gt;Ex.:&lt;code&gt; console.log( vue_choices )&lt;/code&gt; would display:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;Vue {_uid: 0, _isVue: true, $options: {…}, _renderProxy: Proxy, _self: Vue, …}
$attrs: (...)
$children: []
$createElement: ƒ (a, b, c, d)
$el: div#app.demoDiv
$listeners: (...)
$options: {components: {…}, directives: {…}, filters: {…}, _base: ƒ, el: "#app", …}
$parent: undefined
$refs: {}
$root: Vue {_uid: 0, _isVue: true, $options: {…}, _renderProxy: Proxy, _self: Vue, …}
$scopedSlots: {}
$slots: {}
$vnode: undefined
fruits: (...)
veggies: (...)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As you can see, the Vue object is laid out in all its glory. That includes things like variables and functions/ methods. &lt;/p&gt;

&lt;p&gt;So, if you wanted to access a Vue variable or method from Javascript in the page, you would use something like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;console.log(vue_choices.fruits)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Which gives you access to the fruits list:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;4) ["apples", "pears", "peaches", "cherries", __ob__: Observer]
0: "apples"
1: "pears"
2: "peaches"
3: "cherries"&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That means&lt;strong&gt; you an reach into Vue and work with any variables or methods. &lt;/strong&gt;&lt;br&gt;Now you are drunk with power! Muhahah!&lt;/p&gt;

&lt;p&gt;Ok, back to work. &lt;/p&gt;

&lt;p&gt;In our example, we want to tell Vue when 'vegetable' or 'fruit' has been chosen.   Since we're asking &lt;em&gt;Vue&lt;/em&gt; to do the work, it makes sense to &lt;strong&gt;write a function/method &lt;em&gt;in Vue&lt;/em&gt;&lt;/strong&gt;.  &lt;strong&gt;That function can be called from the DOM JavaScript level&lt;/strong&gt;.  &lt;br&gt;&lt;/p&gt;

&lt;p&gt;Because the function can take a parameter, it's a way of passing data from the DOM level into Vue.&lt;/p&gt;

&lt;p&gt;Let's see this in action.&lt;/p&gt;

&lt;p&gt;Create a method in Vue called &lt;code&gt;showChoice()&lt;/code&gt;. The method takes a parameter with the choice, and will display a list based on the choice.&lt;br&gt;Note: The whole show/hide thing uses flag variables,  so we'll add them.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Vue code&lt;/strong&gt; looks something like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;var vue_choices = new Vue({
    el: '#app', //Attach to element id app
    data: {
        fruits: ["apples", "pears", "peaches", "cherries"],
        veggies: ["lettuce", "peas", "carrots", "tomatoes"],

        //Display
        show_fruits: false,
        show_veggies: false,
    },

    methods: {
        showChoices: function (getChoice) {
            //Set display vars according to choice
            switch (getChoice) {
                case 'fruit':
                    this.show_fruits = true;
                    this.show_veggies = false;
                    break;
                case 'veggies':
                    this.show_fruits = false;
                    this.show_veggies = true;
                    break;
                default:
                    this.show_fruits = false;
                    this.show_veggies = false;
            }
        }
    },   // end methods
})  // end vue&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The Vue div uses &lt;a href="https://vuejs.org/v2/guide/conditional.html#v-show"&gt;v-show&lt;/a&gt;  to handle show/hide and looks like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;!-- Div where Vue runs --&amp;gt;
    &amp;lt;div id="app" class="demoDiv"&amp;gt;
        &amp;lt;div v-show="show_fruits"&amp;gt;
            &amp;lt;h3&amp;gt;Fruit choices:&amp;lt;/h3&amp;gt;
            &amp;lt;ul id="fruit_list" style="list-style-type: none"&amp;gt;
                &amp;lt;li v-for="fruit in fruits"&amp;gt;
                    &amp;lt;input type="radio" name="food_selected" v-bind:value="fruit"&amp;gt;{{ fruit }}
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div v-show="show_veggies"&amp;gt;
            &amp;lt;h3&amp;gt;Veggie choices:&amp;lt;/h3&amp;gt;
            &amp;lt;ul id="fruit_list" style="list-style-type: none"&amp;gt;
                &amp;lt;li v-for="veggie in veggies"&amp;gt;
                    &amp;lt;input type="radio" name="food_selected" v-bind:value="veggie"&amp;gt;{{ veggie }}
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Call the Vue Function from JavaScript&lt;/h4&gt;

&lt;p&gt;Now that the &lt;em&gt;function&lt;/em&gt;  &lt;code&gt;showChoices() &lt;/code&gt;is part of the Vue &lt;em&gt;object&lt;/em&gt;  &lt;code&gt;vue_choices&lt;/code&gt;,  you can call it in JavaScript like this:  &lt;strong&gt;&lt;code&gt;vue_choices&lt;/code&gt;&lt;/strong&gt;&lt;code&gt;.showChoice(  )&lt;/code&gt; .&lt;/p&gt;

&lt;p&gt;Of course we need to add the choice parameter, which we get in the JavaScript  &lt;code&gt;doFoodGroup() &lt;/code&gt;function.  &lt;/p&gt;

&lt;p&gt;The function should look like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;function doFoodGroup() {
//Returns what is selected
            var selected = $("input:radio[name ='food_group']:checked").val();
            alert("You selected: " + selected);

            //Send the selection to Vue
            vue_choices.showChoices(selected);
        }&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Putting It Together&lt;/h3&gt;

&lt;p&gt;At this point the user selects a food type (fruit or veggie) and passes the choice to Vue via a Vue function called in JavaScript.  &lt;/p&gt;

&lt;p&gt;Your &lt;strong&gt;HTML code&lt;/strong&gt; should look like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;!-- Load JQuery --&amp;gt;
    &amp;lt;script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha256-pasqAKBDmFT4eHoN2ndd6lN370kFiGUFyTiUHWhU7k8=" crossorigin="anonymous"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load Vue --&amp;gt;
    &amp;lt;script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load script file.  'defer' loads after body is generated --&amp;gt;
    &amp;lt;script src="vue_demo.js" defer&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script type="text/javascript"&amp;gt;
        function doFoodGroup() {
            //Returns what is selected

            var selected = $("input:radio[name ='food_group']:checked").val();
            showSelection(selected);

            //Send selection to Vue
            vue_choices.showChoices(selected);
        }

        function showSelection(getSelection) {
            alert("You selected: " + getSelection);
        }
    &amp;lt;/script&amp;gt;

    &amp;lt;style&amp;gt;
        .demoDiv {
            display: inline-block;
            width: 49%;
            vertical-align: top;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;JQuery and Vue&amp;lt;/h1&amp;gt;
    &amp;lt;div class="demoDiv"&amp;gt;
        &amp;lt;h2&amp;gt;Select a Food Group:&amp;lt;/h2&amp;gt;
        &amp;lt;input type="radio" name="food_group" value="fruit" onclick="doFoodGroup()" /&amp;gt; Fruit
        &amp;lt;br /&amp;gt;
        &amp;lt;input type="radio" name="food_group" value="veggies" onclick="doFoodGroup()" /&amp;gt; Veggie
    &amp;lt;/div&amp;gt;
    &amp;lt;!-- Div where Vue runs --&amp;gt;
    &amp;lt;div id="app" class="demoDiv"&amp;gt;
        &amp;lt;div v-show="show_fruits"&amp;gt;
            &amp;lt;h3&amp;gt;Fruit choices:&amp;lt;/h3&amp;gt;
            &amp;lt;ul id="fruit_list" style="list-style-type: none"&amp;gt;
                &amp;lt;li v-for="fruit in fruits"&amp;gt;
                    &amp;lt;input type="radio" name="food_selected" v-bind:value="fruit" /&amp;gt;{{ fruit }}
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div v-show="show_veggies"&amp;gt;
            &amp;lt;h3&amp;gt;Veggie choices:&amp;lt;/h3&amp;gt;
            &amp;lt;ul id="fruit_list" style="list-style-type: none"&amp;gt;
                &amp;lt;li v-for="veggie in veggies"&amp;gt;
                    &amp;lt;input type="radio" name="food_selected" v-bind:value="veggie" /&amp;gt;{{ veggie }}
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Your &lt;strong&gt;Vue code&lt;/strong&gt; should look like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;var vue_choices = new Vue({
    el: '#app', //Attach to element id app
    data: {
        fruits: ["apples", "pears", "peaches", "cherries"],
        veggies: ["lettuce", "peas", "carrots", "tomatoes"],

        //Display
        show_fruits: false,
        show_veggies: false,
    },

    methods: {
        showChoices: function (getChoice) {
            //Set display vars according to choice
            switch (getChoice) {
                case 'fruit':
                    this.show_fruits = true;
                    this.show_veggies = false;
                    break;
                case 'veggies':
                    this.show_fruits = false;
                    this.show_veggies = true;
                    break;
                default:
                    this.show_fruits = false;
                    this.show_veggies = false;
            }
        },

    },   // end methods
})  // end vue&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we're getting some where!&lt;/p&gt;

&lt;h3&gt;Vue Data Vars vs Methods / Functions&lt;/h3&gt;

&lt;p&gt;Although you can change a Vue variable directly through JavaScript by using something like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;vue_choices.show_fruits = false&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Using a method is probably a better idea.  Remember:  Change Lanes Politely.&lt;/p&gt;

&lt;p&gt;Why?  That variable may be manipulated within Vue and JavaScript making changes from the outside may cause problems. So &lt;strong&gt;change Vue data vars through a method&lt;/strong&gt; (and save yourself a headache)!&lt;/p&gt;

&lt;h2&gt;Passing Data from Vue to Javascript &lt;/h2&gt;

&lt;p&gt;We just called a Vue method to pass a parameter &lt;em&gt;to&lt;/em&gt; Vue &lt;em&gt;from&lt;/em&gt; Javascript.  If you want to go the other way and pass a parameter &lt;em&gt;from&lt;/em&gt; Vue &lt;em&gt;to&lt;/em&gt; JavaScript, it's the same idea only backwards.   Yup, that means &lt;strong&gt;calling a JavaScript function inside Vue.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Note:  Yes, you can access the JavaScript variable directly, but a function is less risky if something changes.&lt;/p&gt;

&lt;p&gt;In this example, let's say whenever the user selects a specific fruit or veggies, we need to pass that choice back to the function &lt;code&gt;showSelection()&lt;/code&gt; in the main document.  &lt;/p&gt;

&lt;p&gt;As you're pondering this problem, you're probably thinking using an onChange event to fire &lt;code&gt;showSelection()&lt;/code&gt; is the solution.&lt;br&gt;No it's not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gotcha!  Regular JavaScript events don't work well in Vue elements.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you try to add a regular 'onchange' event to the element, Vue will ignore it.  It uses v-on:click.  &lt;br&gt;If you try to run something like:   &lt;code&gt;v-on:click=" showSelection()"&lt;/code&gt;, that won't work either because &lt;code&gt;showSelection()&lt;/code&gt; is not a Vue thing. &lt;/p&gt;

&lt;p&gt;Remember, Vue's job is to handle its section of the DOM.  If you change an element &lt;em&gt;outside of Vue&lt;/em&gt;, it causes problems.  Stay in your lane!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:  Access JavaScript objects (functions) inside Vue&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Although the Vue&lt;em&gt; DOM &lt;/em&gt;doesn't like regular JavaScript (or jQuery) in it, Vue&lt;em&gt; methods&lt;/em&gt; are cool using JavaScript objects.  &lt;br&gt;Using jQuery inside your Vue file is possible, but probably not worth the fight.  Stick with JavaScript if you can.&lt;/p&gt;

&lt;p&gt;So, the approach is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a Vue Method &lt;/strong&gt;that fires the parent document &lt;code&gt;showSelection()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;In the Vue div, use &lt;strong&gt;v-onclick="vueMethod()" &lt;/strong&gt;to run it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Vue Method&lt;/h3&gt;

&lt;p&gt;The method is very simple, just run the function defined in the parent document.  Make sure it takes a parameter that can be passed to  &lt;code&gt;showSelection()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That means it looks something like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt; getSelection: function(selection) {
                showSelection(selection)
            }&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Wait!  You can just use the JavaScript function defined in the document inside Vue?&lt;br&gt;Yup, that the whole point.&lt;/p&gt;

&lt;p&gt;The function is a JavaScript object, Vue is JavaScript and has access to the objects.  That's how it all works.&lt;/p&gt;

&lt;p&gt; Your &lt;strong&gt;Vue code&lt;/strong&gt; should look like: &lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;var vue_choices = new Vue({
        el: '#app', //Attach to element id app
        data: {
            fruits: ["apples", "pears", "peaches", "cherries"],
            veggies: ["lettuce", "peas", "carrots", "tomatoes"],

            //Display
            show_fruits: false,
            show_veggies: false,
        },

        methods: {
            showChoices: function(getChoice) {
                //Set display vars according to choice
                switch (getChoice) {
                    case 'fruit':
                        this.show_fruits = true;
                        this.show_veggies = false;
                        break;
                    case 'veggies':
                        this.show_fruits = false;
                        this.show_veggies = true;
                        break;
                    default:
                        this.show_fruits = false;
                        this.show_veggies = false;
                }
            },

            getSelection: function(selection) {
                showSelection(selection)
            }

        }, // end methods
    }) // end vue&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt; Update the Vue Div&lt;/h3&gt;

&lt;p&gt;We have the method, we want to fire it when a fruit or veggie is selected.  So you would change your inputs to something like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;input type="radio" name="food_selected" v-bind:value="fruit" v-on:click="getSelection(fruit)" /&amp;gt; &lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Passing Parameters: Bind Values&lt;/h4&gt;

&lt;p&gt;You want to pass the value of the input to the method.  The value is defined by &lt;code&gt;v-bind:value="fruit"&lt;/code&gt;, this is what is tied to that input.&lt;/p&gt;

&lt;p&gt;Oh, don't forget to change the 'veggie' inputs one too!&lt;/p&gt;

&lt;p&gt;Your &lt;strong&gt;html file&lt;/strong&gt; should look like this:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;!-- Load JQuery --&amp;gt;
    &amp;lt;script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha256-pasqAKBDmFT4eHoN2ndd6lN370kFiGUFyTiUHWhU7k8=" crossorigin="anonymous"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load Vue --&amp;gt;
    &amp;lt;script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load script file.  'defer' loads after body is generated --&amp;gt;
    &amp;lt;script src="vue_demo.js" defer&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script type="text/javascript"&amp;gt;
        function doFoodGroup() {
            //Returns what is selected

            var selected = $("input:radio[name ='food_group']:checked").val();
            showSelection(selected);

            //Send selection to Vue
            vue_choices.showChoices(selected);
        }

        function showSelection(getSelection) {
            alert("You selected: " + getSelection);
        }
    &amp;lt;/script&amp;gt;

    &amp;lt;style&amp;gt;
        .demoDiv {
            display: inline-block;
            width: 49%;
            vertical-align: top;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;JQuery and Vue&amp;lt;/h1&amp;gt;
    &amp;lt;div class="demoDiv"&amp;gt;
        &amp;lt;h2&amp;gt;Select a Food Group:&amp;lt;/h2&amp;gt;
        &amp;lt;input type="radio" name="food_group" value="fruit" onclick="doFoodGroup()" /&amp;gt; Fruit
        &amp;lt;br /&amp;gt;
        &amp;lt;input type="radio" name="food_group" value="veggies" onclick="doFoodGroup()" /&amp;gt; Veggie
    &amp;lt;/div&amp;gt;
    &amp;lt;!-- Div where Vue runs --&amp;gt;
    &amp;lt;div id="app" class="demoDiv"&amp;gt;
        &amp;lt;div v-show="show_fruits"&amp;gt;
            &amp;lt;h3&amp;gt;Fruit choices:&amp;lt;/h3&amp;gt;
            &amp;lt;ul id="fruit_list" style="list-style-type: none"&amp;gt;
                &amp;lt;li v-for="fruit in fruits"&amp;gt;
                    &amp;lt;input type="radio" name="food_selected" v-bind:value="fruit" v-on:click="getSelection(fruit)" /&amp;gt;{{ fruit }}
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div v-show="show_veggies"&amp;gt;
            &amp;lt;h3&amp;gt;Veggie choices:&amp;lt;/h3&amp;gt;
            &amp;lt;ul id="fruit_list" style="list-style-type: none"&amp;gt;
                &amp;lt;li v-for="veggie in veggies"&amp;gt;
                    &amp;lt;input type="radio" name="food_selected" v-bind:value="veggie" v-on:click="getSelection(veggie)" /&amp;gt;{{ veggie }}
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Summary&lt;/h2&gt;

&lt;p&gt;Yes you can inject some Vue into a project built with regular JavaScript or jQuery.  It's not all or nothing.&lt;/p&gt;

&lt;p&gt;You can pass data between JavaScript and Vue because it you're dealing with JavaScript objects.  JavaScript can look at Vue, Vue has access to functions written in the document.&lt;/p&gt;

&lt;p&gt;The trick is to 'stay in your lane' -- work with whatever is controlling the element you're changing.&lt;/p&gt;

&lt;p&gt;Keep jQuery outside of Vue, it's easier that way.&lt;/p&gt;

&lt;h3&gt;Files&lt;/h3&gt;

&lt;p&gt;You can find the files for this tutorial on GitHub:&lt;br&gt; &lt;a href="https://github.com/workingwebsites/vue-jquery-javascript" rel="noreferrer noopener"&gt;https://github.com/workingwebsites/vue-jquery-javascript &lt;/a&gt;&lt;/p&gt;



</description>
      <category>vue</category>
      <category>javascript</category>
      <category>jquery</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Using Vue for APIs</title>
      <dc:creator>Lisa Armstrong</dc:creator>
      <pubDate>Thu, 25 Jul 2019 03:36:29 +0000</pubDate>
      <link>https://forem.com/workingwebsites/using-vue-for-apis-k4j</link>
      <guid>https://forem.com/workingwebsites/using-vue-for-apis-k4j</guid>
      <description>&lt;p&gt;At some level, most apps use data and it's probably coming from an API. In this tutorial, we'll use Vue to fetch the data and display it.&lt;/p&gt;

&lt;h1&gt;This example&lt;/h1&gt;

&lt;p&gt;Let's say you need to display a list of countries in North America. The list will show the country, the capital and its population.&lt;/p&gt;

&lt;p&gt;You found the API with the data called &lt;a rel="noreferrer noopener" href="https://restcountries.eu/"&gt;REST Countries&lt;/a&gt;, it has country size and population -- just what you need.&lt;/p&gt;

&lt;h1&gt;Welcome to API, Can I Take Your Order?&lt;/h1&gt;

&lt;p&gt;When you think about it, APIs are kind of like drive-through restaurants, you make a request and get a response. However, you need to know a few things such as:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Where is the food / data located? &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You need to the address of the restaurant like you need to know the URL for the API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. What's on the menu? &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Do you ask for 'chips' or 'fries'? &lt;br&gt;Yeah, they're the same, but you need to use the right word / parameters to get what you want. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. What do you get?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you're handed your food / data in a package, you need to know what's in there. Is ketchup included or vinegar? Likewise, what fields and formats are returned?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Can you make special requests? &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;How do you get extra napkins / request certain fields?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read the Menu&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's good to have an idea of what's involved with the API before beginning your project. Have a look at the menu / documentation, it'll make the job easier. &lt;/p&gt;

&lt;h1&gt;Accessing APIs In Vue&lt;/h1&gt;

&lt;p&gt;Vue is a javascript framework, so it doesn't have a specific method to use APIs. Ajax or Fetch are ok. &lt;a rel="noreferrer noopener" href="https://github.com/axios/axios"&gt;Axios &lt;/a&gt;is often recommended because it's simple to use and works, so we'll use that.&lt;/p&gt;

&lt;p&gt;Enough theory, let's get our hands on the keyboard and start coding!&lt;/p&gt;

&lt;h2&gt;The Basic Set-Up&lt;/h2&gt;

&lt;p&gt;To keep things simple, we'll build the app in a web page.&lt;/p&gt;

&lt;p&gt;For that, we'll use two files,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HTML file to display the data and load the Vue file.&lt;/li&gt;
&lt;li&gt;The Vue file has the code.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;HTML File:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;!-- Load Vue --&amp;gt;
    &amp;lt;script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load script file.  'defer' loads after body is generated --&amp;gt;
    &amp;lt;script src="vue_lists.js" defer&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;style&amp;gt;
        table,
        th,
        td {
            border: 1px solid #cccccc;
            border-collapse: collapse;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;North America&amp;lt;/h1&amp;gt;
    &amp;lt;!-- Div where Vue runs --&amp;gt;
    &amp;lt;div id="app"&amp;gt;
        &amp;lt;h2&amp;gt;Table&amp;lt;/h2&amp;gt;
        &amp;lt;table&amp;gt;
            &amp;lt;tr&amp;gt;
                &amp;lt;th&amp;gt;Country&amp;lt;/th&amp;gt;
                &amp;lt;th&amp;gt;Capital&amp;lt;/th&amp;gt;
                &amp;lt;th&amp;gt;Population&amp;lt;/th&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
                &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
                &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
                &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
        &amp;lt;/table&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Vue.js File:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this file we're using 'countries_list' as the array that will contain the data. It's empty for now.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var app = new Vue({
    el: '#app',
    data: {
        countries_list: [],
    },
})&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Loading Axios&lt;/h2&gt;

&lt;p&gt;To use Axios in your application, you need to load it. We're keeping it simple, so we'll use the cdn, which we'll add to the HTML header.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;!-- Load Axios --&amp;gt;
    &amp;lt;script src="https://unpkg.com/axios/dist/axios.min.js"&amp;gt;&amp;lt;/script&amp;gt; &lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now that it's loaded, you can access it in Vue.&lt;/p&gt;

&lt;h2&gt;Get the Data&lt;/h2&gt;

&lt;p&gt;Back to the drive-through metaphor. We're in the car (Axios), ready to head out. We know the location (url), we read the menu (documentation) so we know what to ask for (url string). &lt;br&gt;Let's place an order! &lt;/p&gt;

&lt;p&gt;Based on the documentation, the request string should look like: &lt;a href="https://restcountries.eu/rest/v2/region/americas" rel="noopener noreferrer"&gt;https://restcountries.eu/rest/v2/region/americas&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great!  We know how to get the data, now lets get it on the screen. The data should  display as soon as the page is loaded, so how do you do that?&lt;/p&gt;

&lt;h2&gt;Hang It On A Hook&lt;/h2&gt;

&lt;p&gt;Vue has a series of &lt;a rel="noopener noreferrer" href="https://vuejs.org/v2/guide/instance.html"&gt;life cycle hooks&lt;/a&gt; that fire at certain stages during loading. The '&lt;strong&gt;mounted&lt;/strong&gt;' hook fires when the Dom is loaded.  That works!  We'll put the Axios call in there and set it up so we can have a look at the raw data in the console log.   &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mounted() {
        axios
            .get('https://restcountries.eu/rest/v2/region/americas')
            .then(response =&amp;gt; (
                console.log(response)
                ))
    }&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Breakdown:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt; mounted() { ...}&lt;/td&gt;
&lt;td&gt; When the dom is loaded &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; axios &lt;/td&gt;
&lt;td&gt; Tell Axios to... &lt;br&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; .get (....)&lt;/td&gt;
&lt;td&gt; ...use 'get' to go to this url and return the data &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;.then (...)&lt;br&gt;
&lt;/td&gt;
&lt;td&gt; Once the data is returned...&lt;br&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;response =&amp;gt; ( &lt;br&gt;console.log(response)&lt;br&gt;)&lt;/td&gt;
&lt;td&gt;... call the data 'response' and show it in the console log.  &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;Putting It Together&lt;/h2&gt;

&lt;p&gt;The code should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;!-- Load Vue --&amp;gt;
    &amp;lt;script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load Axios --&amp;gt;
    &amp;lt;script src="https://unpkg.com/axios/dist/axios.min.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load script file.  'defer' loads after body is generated --&amp;gt;
    &amp;lt;script src="vue_lists.js" defer&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;style&amp;gt;
        table,
        th,
        td {
            border: 1px solid #cccccc;
            border-collapse: collapse;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;North America&amp;lt;/h1&amp;gt;
    &amp;lt;!-- Div where Vue runs --&amp;gt;
    &amp;lt;div id="app"&amp;gt;
        &amp;lt;h2&amp;gt;Table&amp;lt;/h2&amp;gt;
        &amp;lt;table&amp;gt;
            &amp;lt;tr&amp;gt;
                &amp;lt;th&amp;gt;Country&amp;lt;/th&amp;gt;
                &amp;lt;th&amp;gt;Capital&amp;lt;/th&amp;gt;
                &amp;lt;th&amp;gt;Population&amp;lt;/th&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
                &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
                &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
                &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
        &amp;lt;/table&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Vue.js File:&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var app = new Vue({
    el: '#app',
    data: {
        countries_list: [],
    },

    mounted() {
        axios
            .get('https://restcountries.eu/rest/v2/region/americas')
            .then(response =&amp;gt; (
                console.log(response)
                ))
    }

})&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The data in the console log looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{data: Array(57), status: 200, statusText: "", headers: {…}, config: {…}, …}
config: {adapter: ƒ, transformRequest: {…}, transformResponse: {…}, timeout: 0, xsrfCookieName: "XSRF-TOKEN", …}
data: (57) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
headers: {content-type: "application/json;charset=utf-8", cache-control: "public, max-age=86400"}
request: XMLHttpRequest {onreadystatechange: ƒ, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}
status: 200
statusText: ""
__proto__: Object&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It has everything we need, plus a whole lot more!&lt;/p&gt;

&lt;h3&gt;Pulling Out What You Need&lt;/h3&gt;

&lt;p&gt;Like a drive-through, you need to unpack the package to get to the food / data.&lt;/p&gt;

&lt;p&gt;What we're seeing here is the &lt;em&gt;full&lt;/em&gt; response, the status, the headers, the whole package.  It's like being handed the bag at the drive-through window, we don't need the wrappers, just the food (data), so we need to unpack it a bit.  You can do that by tweaking the code to return the response.&lt;strong&gt;data&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;.then(response =&amp;gt; (
                console.log(response.data)
                ))&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Tip:  Because &lt;em&gt;response&lt;/em&gt; returns everything, it's a good debugging tool.&lt;/p&gt;

&lt;p&gt;The console log should look something like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(57) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
0: {name: "Anguilla", topLevelDomain: Array(1), alpha2Code: "AI", alpha3Code: "AIA", callingCodes: Array(1), …}
1: {name: "Antigua and Barbuda", topLevelDomain: Array(1), alpha2Code: "AG", alpha3Code: "ATG", callingCodes: Array(1), …}
2: {name: "Argentina", topLevelDomain: Array(1), alpha2Code: "AR", alpha3Code: "ARG", callingCodes: Array(1), …}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's better! &lt;/p&gt;

&lt;h3&gt;Making the Data Workable&lt;/h3&gt;

&lt;p&gt;The next step is to assign the data to a variable we can use to in the HTML file.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;.then(response =&amp;gt; (
                this.countries_list = response.data
                ))&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now countries_list has the data, we'll set up the HTML page to display it.&lt;/p&gt;

&lt;h2&gt;Displaying Data&lt;/h2&gt;

&lt;p&gt;We already have the table set up in the HTML file, we just need to get the data in there.&lt;/p&gt;

&lt;p&gt;Right now, data is in an array called 'countries_list'. The trick here is to loop through it and display it in the table. This is done by using '&lt;a href="https://vuejs.org/v2/guide/list.html" rel="noopener noreferrer"&gt;v-for&lt;/a&gt;', it's a kind of 'for loop' for Vue. You put inside an element that you want repeated for every record in the database.&lt;/p&gt;

&lt;p&gt;Our example looks like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;tr v-for="country in countries_list"&amp;gt;
    &amp;lt;td&amp;gt;{{country.name}}&amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;{{country.capital}}&amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;{{country.population}}&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Breakdown:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt; &amp;lt;tr v-for="country in countries_list"&amp;gt; &lt;/td&gt;
&lt;td&gt;Create a&lt;strong&gt; &amp;lt;tr&amp;gt;&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;for&lt;/strong&gt; every record &lt;strong&gt;in&lt;/strong&gt; '&lt;strong&gt;coutry_list&lt;/strong&gt;',&lt;br&gt;each record will be called '&lt;strong&gt;country&lt;/strong&gt;'&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;br&gt;&amp;lt;td&amp;gt;{{country.name}}&amp;lt;/td&amp;gt;&lt;br&gt;&amp;lt;td&amp;gt;{{country.capital}}&amp;lt;/td&amp;gt;&lt;br&gt;&amp;lt;td&amp;gt;{{country.population}}&amp;lt;/td&amp;gt; &lt;/td&gt;
&lt;td&gt;To display data in Vue, you use the double  curly brackets.&lt;br&gt;So, for each record, create the &amp;lt;td&amp;gt;&lt;br&gt;and wrap the data (called '&lt;strong&gt;country&lt;/strong&gt;') &lt;br&gt;and the field (&lt;strong&gt;name&lt;/strong&gt;, capital population etc.) in the &lt;strong&gt;curly brackets&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;/tr&amp;gt;&lt;/td&gt;
&lt;td&gt;End of the row.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The HTML page should look like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;!-- Load Vue --&amp;gt;
    &amp;lt;script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load Axios --&amp;gt;
    &amp;lt;script src="https://unpkg.com/axios/dist/axios.min.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load script file.  'defer' loads after body is generated --&amp;gt;
    &amp;lt;script src="vue_lists.js" defer&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;style&amp;gt;
        table,
        th,
        td {
            border: 1px solid #cccccc;
            border-collapse: collapse;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;North America&amp;lt;/h1&amp;gt;
    &amp;lt;!-- Div where Vue runs --&amp;gt;
    &amp;lt;div id="app"&amp;gt;
        &amp;lt;h2&amp;gt;Table&amp;lt;/h2&amp;gt;
        &amp;lt;table&amp;gt;
            &amp;lt;tr&amp;gt;
                &amp;lt;th&amp;gt;Country&amp;lt;/th&amp;gt;
                &amp;lt;th&amp;gt;Capital&amp;lt;/th&amp;gt;
                &amp;lt;th&amp;gt;Population&amp;lt;/th&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr v-for="country in countries_list"&amp;gt;
                &amp;lt;td&amp;gt;{{country.name}}&amp;lt;/td&amp;gt;
                &amp;lt;td&amp;gt;{{country.capital}}&amp;lt;/td&amp;gt;
                &amp;lt;td&amp;gt;{{country.population}}&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
        &amp;lt;/table&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The table should look like:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;Country&lt;/th&gt;
&lt;th&gt;Capital&lt;/th&gt;
&lt;th&gt;Population&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Anguilla&lt;/td&gt;
&lt;td&gt;The Valley&lt;/td&gt;
&lt;td&gt;13452&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Antigua and Barbuda&lt;/td&gt;
&lt;td&gt;Saint John's&lt;/td&gt;
&lt;td&gt;86295&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Argentina&lt;/td&gt;
&lt;td&gt;Buenos Aires&lt;/td&gt;
&lt;td&gt;43590400&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aruba&lt;/td&gt;
&lt;td&gt;Oranjestad&lt;/td&gt;
&lt;td&gt;107394&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bahamas&lt;/td&gt;
&lt;td&gt;Nassau&lt;/td&gt;
&lt;td&gt;378040&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Barbados&lt;/td&gt;
&lt;td&gt;Bridgetown&lt;/td&gt;
&lt;td&gt;285000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We're getting somewhere!&lt;/p&gt;

&lt;h2&gt;Using API's in an Element &lt;br&gt;(or How to Use Vue in &amp;lt;img  and Other Tags)&lt;/h2&gt;

&lt;p&gt;This API has a flag image for each country. That's a nice visual cue,  so let's add that beside the country.&lt;/p&gt;

&lt;p&gt;Although you use the double curly brackets for displaying API data in Vue, &lt;em&gt;when you're applying it to an HTML element like an image tag, it works differently. &lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here you &lt;strong&gt;use &lt;a rel="noreferrer noopener" href="https://vuejs.org/v2/guide/syntax.html#Attributes"&gt;v-bind&lt;/a&gt; to tie data to an attribute.&lt;/strong&gt; So the image tag would look something like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;img v-bind:src="country.flag" alt="Flag" height="26" width="42"&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let's add it to the table. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;tr v-for="country in countries_list"&amp;gt;
  &amp;lt;td&amp;gt;
     &amp;lt;img v-bind:src="country.flag" alt="Flag" height="26" width="42"&amp;gt; 
      {{country.name}}
   &amp;lt;/td&amp;gt;
   &amp;lt;td&amp;gt;{{country.capital}}&amp;lt;/td&amp;gt;
   &amp;lt;td&amp;gt;{{country.population}}&amp;lt;/td&amp;gt;
 &amp;lt;/tr&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Passing Parameters&lt;/h2&gt;

&lt;p&gt;With this API, you can pass a parameter to it telling it what fields to return. We only need&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Country&lt;/li&gt;
&lt;li&gt;Short form&lt;/li&gt;
&lt;li&gt;Size&lt;/li&gt;
&lt;li&gt;Population&lt;/li&gt;
&lt;li&gt;Flag&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Based on the &lt;a href="https://restcountries.eu/#filter-response" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;, the URL should look like:&lt;br&gt; &lt;a href="https://restcountries.eu/rest/v2/region/americas?fields=name;capital;flag;population" rel="noopener noreferrer"&gt;https://restcountries.eu/rest/v2/region/americas?fields=name;capital;flag;population&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;We can change the Axios call to:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;mounted() {
        axios
            .get('https://restcountries.eu/rest/v2/region/americas?fields=name;capital;flag;population')
            .then(response =&amp;gt; (
                this.countries_list = response.data,
                console.log(response.data)
                ))
    }&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Nothing has changed in the results but if you look in the console, you'll only see the data you need.  Easy, huh?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[{"flag":"https://restcountries.eu/data/aia.svg","name":"Anguilla","capital":"The Valley","population":13452},{"flag":"https://restcountries.eu/data/atg.svg","name":"Antigua and Barbuda","capital":"Saint John's","population":86295},{"flag":"https://restcountries.eu/data/arg.svg","name":"Argentina","capital":"Buenos Aires","population":43590400},{"flag":"https://restcountries.eu/data/abw.svg","name":"Aruba","capital":"Oranjestad","population":107394},
.....&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When passing the parameters in this case, it was simple -- a 'get' string. Of course some API's and apps are more complex and may require 'post' variables etc.  Axios does a nice job of passing variables among many other things.  For more info see:   &lt;a href="https://github.com/axios/axios" rel="noopener noreferrer"&gt;https://github.com/axios/axios&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;Handling Errors &amp;amp; Missing Data&lt;/h2&gt;

&lt;p&gt;What happened if there's a problem? Data is not returned, the restaurant is closed, then what?&lt;/p&gt;

&lt;p&gt;You use catch. Catch will, well, catches the error so you handle it gracefully. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;.catch(error =&amp;gt;(
                console.log(error)
                ));&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As a rule you let the user know that there was a problem. Although you could set up some code within catch error, it's probably easier to set up an &lt;strong&gt;&lt;a href="https://vuejs.org/v2/api/#v-if" rel="noopener noreferrer"&gt;v-if&lt;/a&gt;&lt;/strong&gt; statement in the HTML file.&lt;/p&gt;

&lt;p&gt;In this case, if the 'countries_list' is empty, then let the user know.  This can be done in the HTML page by adding another row that will display if the  countries_list.length is 0. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;tr v-if="countries_list.length == 0"&amp;gt;
    &amp;lt;td colspan="3"&amp;gt;
        No records found.
    &amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Breakdown:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;   &amp;lt;tr v-if="countries_list.length == 0"&amp;gt; &lt;/td&gt;
&lt;td&gt;Create a&lt;strong&gt; &amp;lt;tr&amp;gt;&lt;/strong&gt;&lt;br&gt;&lt;strong&gt;if&lt;/strong&gt; the length of the array countries_list is zero&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;br&gt; &amp;lt;td colspan="3"&amp;gt;&lt;br&gt;     No records found.&lt;br&gt;  &amp;lt;/td&amp;gt; &lt;/td&gt;
&lt;td&gt;Only 1 td is need to expand all three columns that should be there.  We still have 3 heading columns.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;/tr&amp;gt;&lt;/td&gt;
&lt;td&gt;End of the row.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Important!&lt;/strong&gt;  Make sure your 'error row' is outside of the rows generated if there is a list.  They are 2 different things!&lt;/p&gt;

&lt;p&gt;Your table should look something like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;table&amp;gt;
    &amp;lt;!-- Header --&amp;gt;
    &amp;lt;tr&amp;gt;
        &amp;lt;th&amp;gt;Country&amp;lt;/th&amp;gt;
        &amp;lt;th&amp;gt;Capital&amp;lt;/th&amp;gt;
        &amp;lt;th&amp;gt;Population&amp;lt;/th&amp;gt;
    &amp;lt;/tr&amp;gt;
    &amp;lt;!-- Country List --&amp;gt;
    &amp;lt;tr v-for="country in countries_list"&amp;gt;
        &amp;lt;td&amp;gt;
            &amp;lt;img v-bind:src="country.flag" alt="Flag" height="26" width="42"&amp;gt;
            {{country.name}}
        &amp;lt;/td&amp;gt;
        &amp;lt;td&amp;gt;{{country.capital}}&amp;lt;/td&amp;gt;
        &amp;lt;td&amp;gt;{{country.population}}&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
    &amp;lt;!-- Error Row --&amp;gt;
    &amp;lt;tr v-if="countries_list.length == 0"&amp;gt;
        &amp;lt;td colspan="3"&amp;gt;
            No records found.
        &amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Final Product&lt;/h2&gt;

&lt;p&gt;Our HTML code should look like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;!-- Load Vue --&amp;gt;
    &amp;lt;script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load Axios --&amp;gt;
    &amp;lt;script src="https://unpkg.com/axios/dist/axios.min.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load script file.  'defer' loads after body is generated --&amp;gt;
    &amp;lt;script src="vue_lists.js" defer&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;style&amp;gt;
        table,
        th,
        td {
            border: 1px solid #cccccc;
            border-collapse: collapse;
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;North America&amp;lt;/h1&amp;gt;
    &amp;lt;!-- Div where Vue runs --&amp;gt;
    &amp;lt;div id="app"&amp;gt;
        &amp;lt;h2&amp;gt;Table&amp;lt;/h2&amp;gt; 
        &amp;lt;table&amp;gt;
            &amp;lt;!-- Header --&amp;gt;
            &amp;lt;tr&amp;gt;
                &amp;lt;th&amp;gt;Country&amp;lt;/th&amp;gt;
                &amp;lt;th&amp;gt;Capital&amp;lt;/th&amp;gt;
                &amp;lt;th&amp;gt;Population&amp;lt;/th&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;!-- Country List --&amp;gt;
            &amp;lt;tr v-for="country in countries_list"&amp;gt;
                &amp;lt;td&amp;gt;
                    &amp;lt;img v-bind:src="country.flag" alt="Flag" height="26" width="42"&amp;gt;
                    {{country.name}}
                &amp;lt;/td&amp;gt;
                &amp;lt;td&amp;gt;{{country.capital}}&amp;lt;/td&amp;gt;
                &amp;lt;td&amp;gt;{{country.population}}&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;!-- Error Row --&amp;gt;
            &amp;lt;tr v-if="countries_list.length == 0"&amp;gt;
                &amp;lt;td colspan="3"&amp;gt;
                    No records found.
                &amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
        &amp;lt;/table&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Our Vue script should look like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var app = new Vue({
    el: '#app',
    data: {
        countries_list: [],
    },

    mounted() {
        axios
            .get('https://restcountries.eu/rest/v2/region/americas?fields=name;capital;flag;population')
            .then(response =&amp;gt; (
                this.countries_list = response.data
                ))
            .catch(error =&amp;gt;(
                console.log(error)
                ));
    }

})&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And our list should look something like:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;Country&lt;/th&gt; &lt;th&gt;Capital&lt;/th&gt; &lt;th&gt;Population&lt;/th&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frestcountries.eu%2Fdata%2Faia.svg" alt="Flag"&gt;
                    Anguilla
                &lt;/td&gt; &lt;td&gt;The Valley&lt;/td&gt; &lt;td&gt;13452&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frestcountries.eu%2Fdata%2Fatg.svg" alt="Flag"&gt;
                    Antigua and Barbuda
                &lt;/td&gt; &lt;td&gt;Saint John's&lt;/td&gt; &lt;td&gt;86295&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frestcountries.eu%2Fdata%2Farg.svg" alt="Flag"&gt;
                    Argentina
                &lt;/td&gt; &lt;td&gt;Buenos Aires&lt;/td&gt; &lt;td&gt;43590400&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frestcountries.eu%2Fdata%2Fabw.svg" alt="Flag"&gt;
                    Aruba
                &lt;/td&gt; &lt;td&gt;Oranjestad&lt;/td&gt; &lt;td&gt;107394&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frestcountries.eu%2Fdata%2Fbhs.svg" alt="Flag"&gt;
                    Bahamas
                &lt;/td&gt; &lt;td&gt;Nassau&lt;/td&gt; &lt;td&gt;378040&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frestcountries.eu%2Fdata%2Fbrb.svg" alt="Flag"&gt;
                    Barbados
                &lt;/td&gt; &lt;td&gt;Bridgetown&lt;/td&gt; &lt;td&gt;285000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frestcountries.eu%2Fdata%2Fblz.svg" alt="Flag"&gt;
                    Belize
                &lt;/td&gt; &lt;td&gt;Belmopan&lt;/td&gt; &lt;td&gt;370300&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Frestcountries.eu%2Fdata%2Fbmu.svg" alt="Flag"&gt;
                    Bermuda
                &lt;/td&gt; &lt;td&gt;Hamilton&lt;/td&gt; &lt;td&gt;61954&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;To Sum Up&lt;/h2&gt;

&lt;p&gt;Using API's in Vue is fairly straight forward.  Make sure you know how to get your data (the drive-through), assign it to an array variable and display it in HTML.  &lt;/p&gt;

&lt;h2&gt;Resources&lt;/h2&gt;

&lt;p&gt;For more information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/workingwebsites/vue-api" rel="noopener noreferrer"&gt;GitHub Code for this tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vuejs.org/v2/cookbook/using-axios-to-consume-apis.html" rel="noopener noreferrer"&gt;Using Axios to Consume API's&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/axios/axios" rel="noopener noreferrer"&gt;Axios&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vuejs.org/v2/guide/list.html" rel="noopener noreferrer"&gt;Vue Lists&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/workingwebsites/using-vue-to-display-lists-6dn"&gt;Using Vue to Display Lists&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/workingwebsites/using-vue-in-wordpress-1b9l"&gt;Using Vue in WordPress&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



</description>
      <category>vue</category>
      <category>javascript</category>
      <category>api</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Using Vue to Display Lists</title>
      <dc:creator>Lisa Armstrong</dc:creator>
      <pubDate>Fri, 03 May 2019 17:43:55 +0000</pubDate>
      <link>https://forem.com/workingwebsites/using-vue-to-display-lists-6dn</link>
      <guid>https://forem.com/workingwebsites/using-vue-to-display-lists-6dn</guid>
      <description>&lt;p&gt;If you're building a web app at some point there will be a list of data you need on the screen. The data might be in a table, a bullet list or options to choose from on a form.  With Vue, displaying that data is not a big trick. &lt;br&gt;Let's see how it's done!&lt;/p&gt;

&lt;h1&gt;The List Data&lt;/h1&gt;

&lt;p&gt;Say you have a simple list of countries and their short codes to render in various parts your app. This list will probably change,  so you want it generated in one Vue file.&lt;/p&gt;

&lt;h1&gt;Setting It Up&lt;/h1&gt;

&lt;p&gt;To use Vue in your application, you need 3 things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Vue loaded&lt;/li&gt;
&lt;li&gt;An element to contain the code&lt;/li&gt;
&lt;li&gt;The code to display content.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For this tutorial, we'll use a simple HTML file to run the app.&lt;/p&gt;

&lt;h2&gt;The HTML File&lt;/h2&gt;

&lt;p&gt;Your HTML page should look like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;!-- Load Vue --&amp;gt;
    &amp;lt;script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;!-- Load script file.  'defer' loads after body is generated --&amp;gt;
    &amp;lt;script src="vue_lists.js" defer&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;List&amp;lt;/h1&amp;gt;
    &amp;lt;div id="app"&amp;gt;
       &amp;lt;!-- Div where Vue runs --&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notice your app file has 'defer' in the script tag.  Defer means the script will load &lt;em&gt;after&lt;/em&gt; the document has loaded.  That makes sure the container element for the app is loaded before the app code loads.&lt;/p&gt;

&lt;h2&gt;The App File&lt;/h2&gt;

&lt;p&gt;Now the app file (aka vue_lists.js):&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;var app = new Vue({
    el: '#app',
    data: {
        countries_list: [
            { "name": "Canada", "code": "CAN" },
            { "name": "Mexico", "code": "MEX" },
            { "name": "United States of America", "code": "USA" }
        ],
    }
})&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Breaking It Down:&lt;/h3&gt;

&lt;p&gt;The important thing here is:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;data: {
countries_list: [
....
]}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This means the data for this app has an array of objects called 'countries_list'.  All we have to do is display the array of objects in the HTML file.&lt;/p&gt;

&lt;h1&gt;Displaying Data in HTML&lt;/h1&gt;

&lt;p&gt;Normally in Vue, you display data in HTML by putting it inside curly brackets {{ data_object }}.  Since this is an &lt;em&gt;array &lt;/em&gt;of objects, that's not going to work.  You need to iterate through the array to access each item. The &lt;strong&gt;v-for&lt;/strong&gt; directive does exactly that.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;ul id="country_list"&amp;gt;
    &amp;lt;li v-for="country in countries_list"&amp;gt;
        {{ country.name }} ({{ country.code }})
     &amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Breaking It Down&lt;/h3&gt;

&lt;p&gt;The "v-for" is similar to "for each".  It goes through the array, one item at a time, and creates another element.  In this case another &amp;lt;li&amp;gt;.&lt;/p&gt;

&lt;p&gt;The "country in countries_list" means "&lt;em&gt;for &lt;/em&gt;each item &lt;em&gt;in &lt;/em&gt;the array&lt;em&gt; countrie&lt;/em&gt;s&lt;em&gt;_list&lt;/em&gt;, the current one will be called &lt;em&gt;country&lt;/em&gt;".&lt;br&gt;The results are exactly what we want.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Canada (CAN)&lt;/li&gt;
&lt;li&gt;Mexico (MEX)&lt;/li&gt;
&lt;li&gt;United States of America (USA)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Putting it all together:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;!-- Load Vue --&amp;gt;
    &amp;lt;script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;!-- Load script file.  'defer' loads after body is generated --&amp;gt;
    &amp;lt;script src="vue_lists.js" defer&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;List&amp;lt;/h1&amp;gt;
    &amp;lt;div id="app"&amp;gt;
       &amp;lt;ul id="country_list"&amp;gt;
          &amp;lt;li v-for="country in countries_list"&amp;gt;
            {{ country.name }} ({{ country.code }})
         &amp;lt;/li&amp;gt;
       &amp;lt;/ul&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Table&lt;/h2&gt;

&lt;p&gt;Of course creating a table of data works the same way.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;table&amp;gt;
    &amp;lt;tr&amp;gt;
        &amp;lt;th&amp;gt;Country&amp;lt;/th&amp;gt;
        &amp;lt;th&amp;gt;Short Code&amp;lt;/th&amp;gt;
    &amp;lt;/tr&amp;gt;
    &amp;lt;tr v-for="country in countries_list"&amp;gt;
        &amp;lt;td&amp;gt;{{ country.name }}&amp;lt;/td&amp;gt;
        &amp;lt;td&amp;gt;{{ country.code }}&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Select Elements&lt;/h2&gt;

&lt;p&gt;And it's the same idea for populating a select elements.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;select name="country_code"&amp;gt;
    &amp;lt;option v-for="country in countries_list" v-bind:value="country.code"&amp;gt;
        {{ country.name }}
    &amp;lt;/option&amp;gt;
&amp;lt;/select&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Wait a minute!  What's with this "bind" thing?&lt;/p&gt;

&lt;pre class="wp-block-preformatted"&gt;"v-bind:value="country.code"&lt;/pre&gt;

&lt;p&gt;In Vue, curly brackets don't work for setting attributes&lt;em&gt; &lt;/em&gt;in a tag.  Instead, you &lt;strong&gt;use v-bind to tie data to an attribute&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The thing to know is, you can bind a &lt;em&gt;single value&lt;/em&gt; (country.code), or the &lt;em&gt;entire object&lt;/em&gt; (country). Very helpful when you need the whole data object to work with!&lt;/p&gt;

&lt;h1&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;As your can see, displaying an array of data is really just using the v-for directive.  Having it in HTML gives you all the flexibility you need to display and format the data.  Yeah, it's that simple.  &lt;/p&gt;

&lt;p&gt;Also, because it's in Vue, it's easy to drop into any web project, even &lt;a href="https://dev.to/workingwebsites/using-vue-in-wordpress-1b9l"&gt;WordPress.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Download code: &lt;a href="https://github.com/workingwebsites/vue_lists"&gt;Github&lt;/a&gt;&lt;/p&gt;



</description>
      <category>vue</category>
      <category>beginners</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Using Git to FTP Your Project</title>
      <dc:creator>Lisa Armstrong</dc:creator>
      <pubDate>Mon, 22 Apr 2019 19:39:31 +0000</pubDate>
      <link>https://forem.com/workingwebsites/using-git-to-ftp-your-project-11ig</link>
      <guid>https://forem.com/workingwebsites/using-git-to-ftp-your-project-11ig</guid>
      <description>&lt;p&gt;Git has become a version control standard and for good reason. Its ability to branch projects, track and roll back changes makes development MUCH easier!&lt;/p&gt;

&lt;h2&gt;The Gap Between Git and FTP&lt;/h2&gt;

&lt;p&gt;When developing at some point you upload your work to a server. FTP usually does the trick and there's a couple of ways to deploy your work:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A) Upload ALL the files. &lt;/em&gt;&lt;br&gt;Sure, everything gets uploaded, but it can be time consuming and sometimes files get overwritten that shouldn't.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;B) Only upload changed files. &lt;/em&gt;&lt;br&gt;That makes more sense except keeping track of  which files have been changed can be messy.&lt;/p&gt;

&lt;p&gt;Git knows which files have changed and you've been working with it the whole time, &lt;strong&gt;can't we just use Git to FTP?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No, it doesn't work that way.   Git is a version tracker not a file manager. You could install Git on the live server, but sometimes that's not practical.  With Git, FTP is out of reach.&lt;/p&gt;

&lt;h2&gt;Git-ftp:  Bridging the Gap&lt;/h2&gt;

&lt;p&gt;This is where Git-ftp comes in.  It's a plug-in that adds a set of commands to  Git allowing you to upload your changed files via FTP.   &lt;/p&gt;

&lt;p&gt;As its &lt;a rel="noopener noreferrer" href="https://git-ftp.github.io/"&gt;website&lt;/a&gt; says:&lt;/p&gt;

&lt;blockquote class="wp-block-quote"&gt;
&lt;p&gt; If you use Git and you need to upload your files to an FTP server, Git-ftp can save you some time and bandwidth by uploading only those files that changed since the last upload.&lt;/p&gt;
&lt;p&gt;It keeps track of the uploaded files by storing the commit id in a log file on the server. It uses Git to determine which local files have changed.&lt;/p&gt;
&lt;p&gt;You can easily deploy another branch or go back in the Git history to upload an older version. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Well, that covers it, now doesn't it?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The git-ftp website: &lt;/strong&gt;&lt;a href="https://git-ftp.github.io/" rel="noopener noreferrer"&gt;&lt;strong&gt;https://git-ftp.github.io/&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Note: Git-ftp Is Not A Repo On Your Server&lt;/h3&gt;

&lt;p&gt;Git-ftp doesn't make your server a proper repository! Git is not installed on your server, git-ftp simply tracks changed files and uploads them.  You can upload different branches (which is great!), but you can't pull changed files from your server.  &lt;br&gt;Honestly, I've never found these restriction to be a problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Think of git-ftp as a way to manage ftp uploads not version control.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;How to Use git-ftp in Your Work Flow&lt;/h2&gt;

&lt;p&gt;I've been using git-ftp for a while, and found it smooths out the work flow.  For example, let's say I'm adding a new code called FeatureA to an existing project.&lt;/p&gt;

&lt;p&gt;The process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a new branch called 'FeatureA' in development&lt;/strong&gt;&lt;p&gt;There's no need to pull from the server since it's not a repository.  The official repository is in development.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build and test in development.&lt;/strong&gt;&lt;p&gt;The code works like a charm!&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deploy to the live server.&lt;/strong&gt;&lt;p&gt;A simple command:  &lt;em&gt;git ftp push&lt;/em&gt; will send the new branch files to the server.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test on the live server&lt;/strong&gt;&lt;p&gt;Uh-oh!  Doesn't work as expected, un-do this quick!&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Reinstate the 'master' branch&lt;/strong&gt;&lt;p&gt;Push the branch 'master' to the live server.  Branch 'FeatureA' is gone.  Back to the drawing board.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fix the problem, try again.&lt;/strong&gt;&lt;p&gt;Push branch 'FeatureA' to live server and test.&lt;br&gt;It works! Happy Dance!&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Merge with 'master'&lt;/strong&gt;&lt;p&gt;I have a personal rule that the live server only uses the 'master' branch.  &lt;br&gt;I found if I had another branch live, it was too easy to lose track of which branch was being used.  So, now I'll upload another branch for testing only, but once it checks out, it gets merged into 'master' and 'master' get pushed to the live server.&lt;br&gt;If there is a problem I can still roll 'master' back to before the last merge.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client review and approval&lt;/strong&gt;&lt;p&gt;I keep branch 'FeatureA' on hand until the client has signed-off on it.  &lt;br&gt;Even after it's approved, I'll re-name the branch to something like 'FeatureA_done'.  That keeps the branch around in case I have to go back to it, but the '_done' tells me it is disposable.  I usually get rid of it when I'm sure the change is good.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Although this process may not be ideal for all cases, I have used it for a while and it works for me.  I can use Git functionality and deploy through FTP with minimal friction. The other thing I like, is it's a sure thing.  If you're working with a new server, as long as you can FTP, it should work.  You don't have to spend time configuring the server to run Git etc.  Just focus on your code!&lt;/p&gt;

</description>
      <category>git</category>
      <category>ftp</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Why Projects Should Have Mission Statements</title>
      <dc:creator>Lisa Armstrong</dc:creator>
      <pubDate>Tue, 09 Apr 2019 03:28:01 +0000</pubDate>
      <link>https://forem.com/workingwebsites/why-projects-should-have-mission-statements-4okj</link>
      <guid>https://forem.com/workingwebsites/why-projects-should-have-mission-statements-4okj</guid>
      <description>&lt;p&gt;When starting a project you need to know what you're building and why. The 'what' is pretty obvious, the stakeholder usually tells you they want X and need you to create it. But before I put my hands on the keyboard, I want to know 'why' and for 'who'.&lt;/p&gt;

&lt;p&gt;'Why' and 'who' are important guide posts in a project. They'll point you in the right direction for things like user experience, functionality, platforms as well as keep you focused on what's important. This helps meet expectations, keeps everyone happy and that makes life better!&lt;/p&gt;

&lt;p&gt;The 'what', 'who' and 'why' can be distilled out in a mission statement.&lt;/p&gt;

&lt;h1&gt;Mission Statements Are Not That Hard&lt;/h1&gt;

&lt;p&gt;The process doesn't have to be too involved. No angst filled existential endless meetings are required. In fact, you probably have a good idea of what your mission statement will be from a conversation with stakeholders. It may have gone like this:&lt;br&gt;
"We need a way to manage engineer drawings. They spend too much time looking them up."&lt;/p&gt;

&lt;p&gt;All the elements are there:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What:&lt;/strong&gt; a system to manage drawings faster and easier than before&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For Who:&lt;/strong&gt; engineers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why:&lt;/strong&gt; finding drawings is slow&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, the mission statement would be something like:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The purpose of this project is to make drawings quicker and easier to find for the engineering team.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Sure, that's obvious now, but when you get into the fog of development, it's easy for developers and stakeholders to lose sight of the project goal. New features are suggested, scope creep begins, deadlines get strained and ... well, you know how it goes. In the end, nobody is happy.&lt;/p&gt;

&lt;p&gt;By filtering every feature, idea, suggestion through the mission statement, it keeps things on track.&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;If it doesn't satisfy the mission statement, don't do it!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That doesn't mean don't do it &lt;em&gt;ever&lt;/em&gt;, just don't do it &lt;em&gt;now&lt;/em&gt;, during this project. Make a note of it and review it once the project is over. As I say to clients "That's a great idea! Let's put it on the wish list and we'll come back to it."&lt;/p&gt;

&lt;h1&gt;Focus the Stakeholders&lt;/h1&gt;

&lt;p&gt;Sometimes stake holders aren't perfectly clear about what they're looking for. They know what they want, they agree it's a good idea, but maybe the 'why' and 'who' needs some fleshing out.&lt;/p&gt;

&lt;p&gt;It's helpful to walk them through the mission statement process. Ok, there might be a &lt;em&gt;little&lt;/em&gt; angst, but it's better now than at the end of the project when you hear the dreaded "That's not what we wanted. "&lt;/p&gt;

&lt;h1&gt;Mission Statement Template&lt;/h1&gt;

&lt;p&gt;So, the whole mission statement can really be boiled down to:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The purpose of this project is to ___[&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;do what&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;]___ for ___[&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;who&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;]___ so that ___[&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;why&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;]___.&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;Now That You Have Your Mission Statement...&lt;/h1&gt;

&lt;p&gt;Once you get the 'what', 'who' and 'why' sorted out, other thing fall into place. 'How' will be dictated by the mission statement, specifics like functionality, deliverables etc. become more obvious. In short, you know where you're going, you just need to figure out how to get there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Development Team&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Developers make decisions all day about how a program is going to work. By keeping the mission statement top of mind, it makes decisions a little easier. It's a bit like a mantra -- although chanting it while coding is not required!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stakeholders&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The reward for stakeholders is they know what they're getting and have a yard stick to measure it. If the end product satisfies the mission statement, it's a success. If not, back to the chanting developers.&lt;/p&gt;

&lt;p&gt;Seriously, it helps set and meet expectations -- always a good thing!&lt;/p&gt;

&lt;h1&gt;Summary&lt;/h1&gt;

&lt;p&gt;I know there's a lot of different techniques for getting project requirements out there. A mission statement certainly isn't the only one and definitely not the best for all cases. However, I've found it's simple and useful in clarifying what you're building, why you're building it and who is going to use it.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Using Vue in WordPress</title>
      <dc:creator>Lisa Armstrong</dc:creator>
      <pubDate>Wed, 03 Apr 2019 17:02:32 +0000</pubDate>
      <link>https://forem.com/workingwebsites/using-vue-in-wordpress-1b9l</link>
      <guid>https://forem.com/workingwebsites/using-vue-in-wordpress-1b9l</guid>
      <description>&lt;p&gt;Like peanut butter and jam sometimes two good things are even better together. &lt;/p&gt;

&lt;p&gt;In this tutorial I'll show you how to use Vue in a WordPress site.   The tutorial is meant for those who have coded in WordPress and Vue or is interested in either one.  Knowledge in PHP, WordPress, Javascript, Vue will help.  &lt;/p&gt;

&lt;h2&gt;Vue Programmers: Why WordPress?  &lt;/h2&gt;

&lt;p&gt;Statistically, WordPress runs about a third of the world's websites.  If you've created something in Vue you'd like to share,  WordPress is a good platform to make it available on.  &lt;/p&gt;

&lt;p&gt;You can customize your own site, or share your code on WordPress' plugin repository.&lt;/p&gt;

&lt;h2&gt;WordPress Programmers: Why Vue?  &lt;/h2&gt;

&lt;p&gt;The short answer is, Vue is known for its simplicity and robustness making it a solid choice for development. If you're adding functionality to your site, it makes a good tool to get up and running with. It's in JavaScript, so it's familiar to most developers.&lt;/p&gt;

&lt;p&gt;WordPress uses React,  can I even use Vue?&lt;br&gt;Of course! Although some features in WordPress may be in React,  you are not limited to it.&lt;/p&gt;

&lt;p&gt;WordPress is open source, do what makes you happy.&lt;/p&gt;

&lt;h2&gt;Tutorial Overview&lt;/h2&gt;

&lt;p&gt;We'll make a short code that displays something generated in Vue.  We'll be using a simple example because this is more about how to put Vue and WordPress together rather than what they do.&lt;/p&gt;

&lt;p&gt; The approach is: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a plugin&lt;/strong&gt; in WordPress to use the code &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create a shortcode&lt;/strong&gt; in the plugin&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create your Vue&lt;/strong&gt; code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load Vue&lt;/strong&gt;,  then &lt;strong&gt;your code &lt;/strong&gt;file.  &lt;/li&gt;
&lt;li&gt;Make sure your &lt;strong&gt;.js file is loaded after the dom&lt;/strong&gt; is drawn. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's basically it.  Let's get into the details. &lt;/p&gt;

&lt;h2&gt;WordPress:  The Plugin. &lt;/h2&gt;

&lt;p&gt;Plugins are both simple and robust, they allow you to add functionality to your site.  This plugin will be a simple 'hello world' type. We'll call it '&lt;strong&gt;wp-vue-tutorial&lt;/strong&gt;', so let's begin:&lt;/p&gt;

&lt;h3&gt;1) Create a new folder in your WordPress plugin directory.&lt;/h3&gt;

&lt;p&gt;This is where the files will be kept, it should be the name of the plugin.  For this tutorial let's use:  &lt;br&gt;&lt;strong&gt;/wp-content/plugins/wp-vue-tutorial&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We need a 'master file', so let's make that.&lt;/p&gt;

&lt;h3&gt;2) In the directory, create a master file with the plugin name.&lt;/h3&gt;

&lt;p&gt;This file called '&lt;strong&gt;wp-vue-tutorial.php&lt;/strong&gt;' so it should look like:&lt;br&gt;&lt;strong&gt;/wp-content/plugins/wp-vue-tutorial/wp-vue-tutorial.php&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes, the &lt;strong&gt;plugin name, folder name and master file name are all the same &lt;/strong&gt;so WordPress knows where to find it.&lt;/p&gt;

&lt;p&gt;Once WordPress opens it up, it needs some more info on what this thing is.  That's included in the Header.  We're keeping it simple, so in &lt;strong&gt;wp-vue-tutorial.php&lt;/strong&gt;, add the following code:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;?php
/**
 * Plugin Name: WordPress Vue Tutorial
 * Description: A demo on how to use Vue in WordPress.
 */
?&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;More info:  &lt;a href="https://developer.wordpress.org/plugins/" rel="noreferrer noopener"&gt;https://developer.wordpress.org/plugins/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you go to your WordPress Dashboard, you'll see your plugin.&lt;br&gt;&lt;strong&gt;Dashboard &lt;/strong&gt;-&amp;gt; &lt;strong&gt;Plugins&lt;/strong&gt;&lt;br&gt;It should appear in the list. &lt;/p&gt;

&lt;h3&gt;3) Activate your plugin.&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Click Activate&lt;/strong&gt; on your plugin.&lt;/p&gt;

&lt;p&gt;Now it's loaded,  but not much happens because there's no code to run.  So, let's create a shortcode.&lt;/p&gt;

&lt;p&gt;A shortcode tells WordPress to insert the content generated by your PHP code into the content of the page or post. &lt;br&gt;Ex.  The user enters something like &lt;em&gt;[myshortcode]&lt;/em&gt; and when the page is displayed, it shows '&lt;em&gt;This is content from my shortcode.&lt;/em&gt;'&lt;/p&gt;

&lt;p class="has-small-font-size"&gt;Note:  WordPress' current text editor (Gutenberg) allows you to put in blocks of content in.  A shortcode will still work with that, in fact there is a block specifically for short codes.  We're using shortcodes in this tutorial because it's a standard that works.&lt;/p&gt;

&lt;p&gt; For more info: &lt;a rel="noreferrer noopener" href="https://codex.wordpress.org/Shortcode_API"&gt;https://codex.wordpress.org/Shortcode_API&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;4) Create a shortcode in your Plugin.&lt;/h3&gt;

&lt;p&gt;Add the following code to your plugin file (&lt;strong&gt;wp-vue-tutorial.php&lt;/strong&gt;):&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt; //Add shortscode
 function func_wp_vue(){
   return "Hello Shortcode";
}
add_shortcode( 'wpvue', 'func_wp_vue' );&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Breaking it down:&lt;br&gt;The function func_wp_vue() returns the text Hello Shortcode.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table class="wp-block-table"&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt; add_shortcode(  &lt;/td&gt;
&lt;td&gt;&lt;em&gt;Make this shortcode available.  &lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 'wpvue', &lt;/td&gt;
&lt;td&gt;
&lt;em&gt;The code the user uses in the content&lt;/em&gt;&lt;br&gt;&lt;em&gt;[ 'wpvue'].&lt;/em&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;  'func_wp_vue'  &lt;/td&gt;
&lt;td&gt;&lt;em&gt;The function returning the string to display.  &lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; ); &lt;/td&gt;
&lt;td&gt;&lt;em&gt;End of shortcode.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Your file should look like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;?php
/**
 * Plugin Name: WordPress Vue Tutorial
 * Description: A demo on how to use Vue in WordPress.
 */

//Add shortscode
 function func_wp_vue(){
 return "Hello Shortcode";
}
add_shortcode( 'wpvue', 'func_wp_vue' );
?&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Test it.&lt;br&gt;&lt;strong&gt;Edit&lt;/strong&gt;,  or &lt;strong&gt;add a new&lt;/strong&gt; WordPress &lt;strong&gt;page&lt;/strong&gt;.  In the &lt;strong&gt;content &lt;/strong&gt;area,  type in &lt;strong&gt;[wpvue]&lt;/strong&gt;.&lt;br&gt;&lt;strong&gt;Publish&lt;/strong&gt; the page and have a look at it. You should see &lt;em&gt;Hello Shortcode&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The short code can return more than a word, we can put in an element in the too.&lt;/p&gt;

&lt;p&gt;Let's change the code to:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;//Add shortscode
function func_wp_vue(){
  $str= "&amp;lt;div id='divWpVue'&amp;gt;"
    ."Message from Vue: "
    ."&amp;lt;/div&amp;gt;";
  return $str;
} // end function&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt; Test it again.&lt;/p&gt;

&lt;h2&gt;Set Up Vue&lt;/h2&gt;

&lt;p&gt;To use Vue,  you need three things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Vue js files&lt;/strong&gt; need to be loaded on the page so you can use the framework.  &lt;/li&gt;
&lt;li&gt; You need an &lt;strong&gt;element &lt;/strong&gt;on your page Vue can work in. Usually a div.&lt;/li&gt;
&lt;li&gt; You need your &lt;strong&gt;Vue code in a .js&lt;/strong&gt; file to do its work in the element.  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Load Vue.js&lt;/h3&gt;

&lt;p&gt;Let's start with adding Vue. You can add Vue through a link to a CDN. There's 2 versions, one for development with debugging options and one for production that is faster and leaner.&lt;br&gt;We'll use the development one: &lt;strong&gt;https://cdn.jsdelivr.net/npm/vue/dist/vue.js&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We need to load this into WordPress, which can be done through the magic of '&lt;strong&gt;wp enqueue scripts&lt;/strong&gt;' and '&lt;strong&gt;wp_register_script&lt;/strong&gt;'.&lt;br&gt;This hook automatically load the script into WordPress' head when needed.&lt;/p&gt;

&lt;p&gt;It looks like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;function func_load_vuescripts() {
 wp_register_script( 'wpvue_vuejs', 'https://cdn.jsdelivr.net/npm/vue/dist/vue.js');
}
add_action('wp_enqueue_scripts', 'func_load_vuescripts');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Break down:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table class="wp-block-table"&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt; function func_load_vuescripts() {  &lt;/td&gt;
&lt;td&gt;&lt;em&gt; Define the function .&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; wp_register_script(   &lt;/td&gt;
&lt;td&gt; &lt;em&gt;Tell WP this script exists &lt;/em&gt;&lt;br&gt;&lt;em&gt;(we'll load it later)&lt;/em&gt; .&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;  'wpvue_vuejs',  &lt;/td&gt;
&lt;td&gt;&lt;em&gt;This is the WordPress reference to the script. &lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; ''https://cdn.jsdelivr.net/npm/vue/dist/vue.js'', &lt;/td&gt;
&lt;td&gt;&lt;em&gt;Actual script file.  &lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; );  &lt;/td&gt;
&lt;td&gt; &lt;em&gt;Close the wp_register_script. &lt;/em&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; }  &lt;/td&gt;
&lt;td&gt;&lt;em&gt;Close the function.  &lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;add_action(  &lt;/td&gt;
&lt;td&gt;&lt;em&gt;WordPress, do this.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 'wp_enqueue_scripts',  &lt;/td&gt;
&lt;td&gt;&lt;em&gt;Hook into 'wp_enqueue_scripts'.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 'func_load_vuescripts' &lt;/td&gt;
&lt;td&gt;&lt;em&gt;Do this function for 'wp_enqueue_scripts' .&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; );  &lt;/td&gt;
&lt;td&gt; &lt;em&gt;End action .&lt;/em&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For more info: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Register Scripts: &lt;a rel="noreferrer noopener" href="https://developer.wordpress.org/reference/functions/wp_register_script/%20"&gt;https://developer.wordpress.org/reference/functions/wp_register_script/ &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Enque Scripts:   &lt;a rel="noreferrer noopener" href="https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts%20"&gt;https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts &lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We'll &lt;strong&gt;add the code to your plugin file&lt;/strong&gt;, above the shortcode.&lt;br&gt;It should look like this: &lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;?php
/**
 * Plugin Name: WordPress Vue Tutorial
 * Description: A demo on how to use Vue in WordPress.
 */

//Register Scripts to use 
function func_load_vuescripts() {
 wp_register_script( 'wpvue_vuejs', 'https://cdn.jsdelivr.net/npm/vue/dist/vue.js');
}
add_action('wp_enqueue_scripts', 'func_load_vuescripts');

//Add shortscode
function func_wp_vue(){
  //Build String
  $str= "&amp;lt;div id='divWpVue'&amp;gt;"
  ."Vue code here: "
  ."&amp;lt;/div&amp;gt;";

  //Return
  return $str;
} // end function

//Add shortcode to WordPress
add_shortcode( 'wpvue', 'func_wp_vue' );
?&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Right now, we told WordPress about Vue.js, but we haven't loaded it.  You load it in the shortcode function so it fires when the shortcode is running.  Makes sense?&lt;/p&gt;

&lt;p&gt;Include the following in your shortcode function:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;//Add Vue.js
  wp_enqueue_script('wpvue_vuejs');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Breakdown:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table class="wp-block-table"&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt; wp_enqueue_script(  &lt;/td&gt;
&lt;td&gt;&lt;em&gt; WordPress, load this script &lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 'wpvue_vuejs' &lt;/td&gt;
&lt;td&gt;&lt;em&gt; It's called 'wpvue_vuejs' defined when we registered the script.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; );  &lt;/td&gt;
&lt;td&gt;&lt;em&gt;End enqueue script&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;It should look like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;function func_wp_vue(){
  //Add Vue.js
  wp_enqueue_script('wpvue_vuejs');
  
  //Build String
  $str= "&amp;lt;div id='divWpVue'&amp;gt;"
  ."Vue code here: "
  ."&amp;lt;/div&amp;gt;";

  //Return
  return $str;
} // end function&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now if you run it, not much has changed, but if you were to look in the &lt;strong&gt;source code &lt;/strong&gt;of the page you'd find :&lt;/p&gt;

&lt;p&gt; &lt;strong&gt;&amp;lt;script type='text/javascript' src='https://cdn.jsdelivr.net/npm/vue/dist/vue.js?ver=5.1.1'&amp;gt;&amp;lt;/script&amp;gt;&lt;/strong&gt; &lt;br&gt;&lt;/p&gt;

&lt;p&gt;Vue is now loaded, we can use the div generated in the shortcode ('&lt;em&gt;divWpVue&lt;/em&gt;'), all we need is some Vue code to run in that div.&lt;/p&gt;

&lt;h3&gt;Create Your Code File for Vue&lt;/h3&gt;

&lt;p&gt;Make a new file: &lt;strong&gt;vuecode.js&lt;/strong&gt; your plugin directory:  &lt;br&gt;&lt;strong&gt;wp-content/plugins/wp-vue-tutorial&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;You should have 2 files in there:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; wp-vue-tutorial.php &lt;/li&gt;
&lt;li&gt; vuecode.js &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More Info:&lt;br&gt;&lt;a rel="noreferrer noopener" href="https://vuejs.org/v2/guide/"&gt;https://vuejs.org/v2/guide/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a really simple demo, so include the following code:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;var app = new Vue({
  el: '#divWpVue',
  data: {
    message: 'Hello Vue!'
  }
})&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Breakdown:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table class="wp-block-table"&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;var app = new Vue({&lt;/td&gt;
&lt;td&gt;&lt;em&gt;We're creating a var called 'app' that is actually a Vue instance.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;el: '#divWpVue',&lt;/td&gt;
&lt;td&gt;&lt;em&gt;This app runs in the element 'divWpVue'.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;data: {&lt;/td&gt;
&lt;td&gt;&lt;em&gt;This app has data with it.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;message: 'Hello Vue!'&lt;/td&gt;
&lt;td&gt;&lt;em&gt;One piece of data is called 'message' and has the value  'Hello Vue!' &lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;}&lt;br&gt; })&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Close the data section&lt;br&gt;Close the app section&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For more info on Vue: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a rel="noreferrer noopener" href="https://vuejs.org/v2/guide/index.html"&gt;https://vuejs.org/v2/guide/index.html&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://vuejs.org/v2/guide/#Declarative-Rendering" rel="noreferrer noopener"&gt;https://vuejs.org/v2/guide/#Declarative-Rendering&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In order to display the message, you need to include the data message in the div.  Change your shortcode function  (&lt;strong&gt;func_wp_vue&lt;/strong&gt;) to include &lt;strong&gt;{{message}}&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;The double curly brackets is a way of including Vue stuff in your HTML file. If you add &lt;em&gt;{{message}}&lt;/em&gt; inside the element you've assigned to your Vue instance, it will magically appear. This is the short non-technical answer of course.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important!&lt;/strong&gt;  If you check your file, and everything is working, you will see &lt;em&gt;'Hello Vue!'&lt;/em&gt; where &lt;em&gt;{{message}}&lt;/em&gt; was placed.  If you see &lt;em&gt;{{message}}&lt;/em&gt;, something's not working.&lt;/p&gt;

&lt;p&gt;Let's &lt;strong&gt;add the &lt;/strong&gt;&lt;em&gt;&lt;strong&gt;{{message}}&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt; to the shortcode&lt;/strong&gt;.  &lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;function func_wp_vue(){
  //Add Vue.js
  wp_enqueue_script('wpvue_vuejs');
  
  //Build String
  $str= "&amp;lt;div id='divWpVue'&amp;gt;"
  ."Message from Vue: {{ message }}"
  ."&amp;lt;/div&amp;gt;";

  //Return
  return $str;
} // end function&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you test it now, it won't work, &lt;em&gt;{{message}}&lt;/em&gt; will display, not &lt;em&gt;'Hello Vue!' &lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Why? Because we haven't loaded your &lt;em&gt;vuecode.js&lt;/em&gt;&lt;strong&gt; &lt;/strong&gt;file yet. We can load it the same was as the Vue CDN file, right?&lt;/p&gt;

&lt;p&gt;Hmm... not exactly.   You're on the right track, but there's a couple of Gotcha's to watch out for.  Let's walk through it.&lt;/p&gt;

&lt;p&gt;To register  vuecode.js, you would expect something like the following would work:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt; wp_register_script('my_vuecode', 'vuecode.js')&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;No, it won't because WordPress can't find  &lt;em&gt;vuecode.js.&lt;/em&gt;  &lt;/p&gt;

&lt;p class="has-medium-font-size"&gt;&lt;strong&gt;Gotcha:  Your file isn't loading&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Remember the shortcode is displayed on a page with a different path than the plugin. It's a kind of logistical hall of mirrors, nothing is where it appears.&lt;/p&gt;

&lt;p&gt;To fix it, you need to be more precise about where the file is located. That's handled by adding a WordPress function that returns the path of the plugin file you're using. &lt;strong&gt;plugin_dir_url&lt;/strong&gt; will do the trick.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;wp_register_script('my_vuecode', plugin_dir_url( __FILE__ ).'vuecode.js') &lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;More info on plugin urls:   &lt;a href="https://codex.wordpress.org/Function_Reference/plugins_url" rel="noreferrer noopener"&gt;https://codex.wordpress.org/Function_Reference/plugins_url&lt;/a&gt; &lt;/p&gt;

&lt;p class="has-medium-font-size"&gt;&lt;strong&gt;Gotcha:  Vue.js needs to load first&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your vuecode.js runs on Vue, so make sure those files are loaded &lt;em&gt;before&lt;/em&gt; you start running your Vue code.&lt;/p&gt;

&lt;p&gt;To ensure that, tell WordPress it &lt;em&gt;depends&lt;/em&gt; on Vuejs by &lt;strong&gt;adding the dependency&lt;/strong&gt; to the register_script function.  Use the handle from the Vue.js script register.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;wp_register_script('my_vuecode', plugin_dir_url( __FILE__ ).'vuecode.js', 'wpvue_vuejs' );&lt;/code&gt;&lt;/pre&gt;

&lt;p class="has-medium-font-size"&gt;&lt;strong&gt;GOTCHA:  Your file with Vue code has to come AFTER the DOM loads&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Why? It loads scripts in the &lt;em&gt;head&lt;/em&gt;, but your vuecode.js controlling a div in the &lt;em&gt;body &lt;/em&gt;and it hasn't been loaded yet. It can't find it and throws an error.&lt;/p&gt;

&lt;p&gt;So, &lt;strong&gt;load Vue.js first&lt;/strong&gt;, then the body with the DOM, then the controlling script ( vuecode.js ).  You can do that through the &lt;strong&gt;register script&lt;/strong&gt; by &lt;strong&gt;adding a 'true' value to the parameters&lt;/strong&gt;.  '&lt;em&gt;true&lt;/em&gt;' tells WordPress to load the script in the footer.&lt;/p&gt;

&lt;p&gt;It should look like this:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;wp_register_script('my_vuecode', plugin_dir_url( __FILE__ ).'vuecode.js', 'wpvue_vuejs', true );&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Breaking it down:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table class="wp-block-table is-style-regular"&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;wp_register_script(&lt;/td&gt;
&lt;td&gt;&lt;em&gt;WordPress, register this script.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;'my_vuecode',&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Its handle (reference) .&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;plugin_dir_url( __&lt;strong&gt;FILE&lt;/strong&gt; __).'vuecode.js',&lt;/td&gt;
&lt;td&gt;&lt;em&gt;The file is located in the same directory as this plugin.  This is the link to it.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;'wpvue_vuejs',&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Make sure this is loaded first.  It's a reference to another &lt;strong&gt;registered &lt;/strong&gt;script.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;true &lt;/td&gt;
&lt;td&gt;&lt;em&gt;Load the script in the footer.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;);&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Close the function.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Your function to load the scripts should look like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;//Register scripts to use
function func_load_vuescripts() {
    wp_register_script('wpvue_vuejs', 'https://cdn.jsdelivr.net/npm/vue/dist/vue.js');
    wp_register_script('my_vuecode', plugin_dir_url( __FILE__ ).'vuecode.js', 'wpvue_vuejs', true );
}
add_action('wp_enqueue_scripts', 'func_load_vuescripts');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;More Info on Registering Scripts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Register Script:  &lt;a rel="noreferrer noopener" href="https://developer.wordpress.org/reference/functions/wp_register_script/"&gt;https://developer.wordpress.org/reference/functions/wp_register_script/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Plugin URL:  &lt;a href="https://codex.wordpress.org/Function_Reference/plugin_dir_url" rel="noreferrer noopener"&gt;https://codex.wordpress.org/Function_Reference/plugin_dir_url&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That should do it.  But, you still won't see anything, why not?  &lt;br&gt;After all that, you've only registered the script.  WordPress knows all about it, but you haven't told it to fire it.&lt;/p&gt;

&lt;p class="has-medium-font-size"&gt;&lt;strong&gt;Gotcha:  Don't forget to enqueue /load  the script&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ok, this one is just like enqueing the Vue.js script.   Add the following to the shortcode function -- '&lt;strong&gt;func_wp_vue&lt;/strong&gt;'.&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;wp_enqueue_script('my_vuecode');&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt; '&lt;strong&gt;func_wp_vue &lt;/strong&gt;' should look like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;//Return string for shortcode
function func_wp_vue(){
  //Add Vue.js
  wp_enqueue_script('wpvue_vuejs');
  //Add my code to it
  wp_enqueue_script('my_vuecode');

  //Build String
  $str= "&amp;lt;div id='divWpVue'&amp;gt;"
    ."Message from Vue: {{ message }}"
    ."&amp;lt;/div&amp;gt;";

  //Return to display
  return $str;
} // end function

//Add shortcode to WordPress
add_shortcode( 'wpvue', 'func_wp_vue' );&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Putting It All Together:&lt;/h2&gt;

&lt;p&gt;You should have your plugin called 'wp-vue-tutorial'.  In the plugin directory, there should be 2 files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;vuecode.js&lt;/strong&gt; (that has the Vue code in it)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;wp-vue-tutorial.php&lt;/strong&gt; (with the WordPress code)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt; &lt;strong&gt;vuecode.js&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt; Your Javascript file that runs off of Vue.js should look like the following:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;var app = new Vue({
  el: '#divWpVue',
  data: {
    message: 'Hello Vue!'
  }
})&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;
&lt;strong&gt;wp-vue-tutorial.php&lt;/strong&gt; &lt;/h3&gt;

&lt;p&gt;Your WordPress file that defines the plugin and has the shortcode code in it should look like:&lt;/p&gt;

&lt;pre class="wp-block-code"&gt;&lt;code&gt;&amp;lt;?php
/**
 * Plugin Name: WordPress Vue Tutorial
 * Description: A demo on how to use Vue in WordPress.
 */

//Register scripts to use
function func_load_vuescripts() {
    wp_register_script('wpvue_vuejs', 'https://cdn.jsdelivr.net/npm/vue/dist/vue.js');
    wp_register_script('my_vuecode', plugin_dir_url( __FILE__ ).'vuecode.js', 'wpvue_vuejs', true );
}
//Tell WordPress to register the scripts 
add_action('wp_enqueue_scripts', 'func_load_vuescripts');


//Return string for shortcode
function func_wp_vue(){
  //Add Vue.js
  wp_enqueue_script('wpvue_vuejs');
  //Add my code to it
  wp_enqueue_script('my_vuecode');

  //Build String
  $str= "&amp;lt;div id='divWpVue'&amp;gt;"
    ."Message from Vue: {{ message }}"
    ."&amp;lt;/div&amp;gt;";

  //Return to display
  return $str;
} // end function

//Add shortcode to WordPress
add_shortcode( 'wpvue', 'func_wp_vue' );
?&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p class="has-small-font-size"&gt;Note: You can include the shortcode in a theme's functions.php file, it will still work the same as long as the the theme is being used, or its functions.php file isn't over-written with an upgrade.&lt;br&gt;I prefer the plugin because it separates out the style from the content and usually my Vue code is about content anyway.&lt;/p&gt;

&lt;p&gt;More Info:&lt;br&gt;&lt;a rel="noreferrer noopener" href="https://codex.wordpress.org/Functions_File_Explained"&gt;https://codex.wordpress.org/Functions_File_Explained&lt;/a&gt;&lt;br&gt;&lt;br&gt;If you use the theme functions file, you need to call the file path in relation to your theme, not the plugin.&lt;/p&gt;

&lt;p&gt;More Info:&lt;br&gt;&lt;a rel="noreferrer noopener" href="https://codex.wordpress.org/Function_Reference/get_template_directory"&gt;https://codex.wordpress.org/Function_Reference/get_template_directory&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Download Files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can download the files at:  &lt;br&gt;&lt;a href="https://github.com/workingwebsites/wp-vue-tutorial" rel="noreferrer noopener"&gt;https://github.com/workingwebsites/wp-vue-tutorial&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Ok, so 'Hello Vue' doesn't exactly set the world on fire.  However, once you've got that in there, you can see how you can add a lot of functionality to your WordPress site through Vue.  &lt;/p&gt;

&lt;p&gt;By using Vue in your WordPress site, accessing API's and making your site more interactive gets easier.  Likewise, if you have some crafty code written with Vue, dropping it into a WordPress site (and there's lots of them) is not a big trick.&lt;/p&gt;

&lt;p&gt;Like peanut butter and jam, combining two good things make it better!&lt;/p&gt;



</description>
      <category>vue</category>
      <category>wordpress</category>
      <category>javascript</category>
      <category>web</category>
    </item>
    <item>
      <title>VueJS: The Golidilocks of JS Frameworks?</title>
      <dc:creator>Lisa Armstrong</dc:creator>
      <pubDate>Sun, 17 Mar 2019 19:41:12 +0000</pubDate>
      <link>https://forem.com/workingwebsites/vue----the-golidilocks-of-js-frameworks-3o9j</link>
      <guid>https://forem.com/workingwebsites/vue----the-golidilocks-of-js-frameworks-3o9j</guid>
      <description>&lt;p&gt;There's a number of Javascript frameworks out there and like many developers I recently had to figure out which one worked best for me and my client's needs. &lt;/p&gt;

&lt;p&gt;Frameworks, NPM, MVS, Typescript, ES6, JQuery &lt;em&gt;is so passe&lt;/em&gt;!  A lot has changed over the last couple of years and that's a good thing.  But, which tool to use? &lt;/p&gt;

&lt;p&gt;Most of my work is web applications, CRUD projects using look ups, responding to input and showing data in tables that can be searched and exported.  I use LAMP on the server and the standard HTML, CSS and JavaScript for front end. &lt;/p&gt;

&lt;p&gt;My plan was to use the framework on a project, learning curves are ok, but delivering results is vital!&lt;/p&gt;

&lt;p&gt;So, I entered the Javascript house of the 3 frameworks and had a look around. &lt;/p&gt;

&lt;h1&gt;
  
  
  REACT
&lt;/h1&gt;

&lt;p&gt;At first I looked at React. It seems all the cool kids where using it, so there must be something to it. At the very least it's a good skill set to have. &lt;/p&gt;

&lt;p&gt;However, there is a real learning curve with React. It also seems very component focused where HTML, CSS and code is stored in the same file.&lt;/p&gt;

&lt;p&gt;I know,  I know,  that's the point of it.   I also know that sooner or later there will be changes and it's much easier to send a designer into an HTML file than a JavaScript code block. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sorry React, too hot.&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  ANGULAR
&lt;/h1&gt;

&lt;p&gt;I had used AngularJS in another project and liked it. It was as advertised, an improved JavaScript.  You could plunk it into any HTML file and go.  Through the magic of data binding and vanilla JavaScript,  I could make that DOM sing!&lt;/p&gt;

&lt;p&gt;Alas, AngularJS's days are numbered.  No more new releases, support ends in 2021. The message is clear, this is a dead-end for future development.&lt;/p&gt;

&lt;p&gt;Angular 2 is an option, more robust than JS. I tried it, but it felt a lot like React with its complexity.  I know they're not the same, this is a generalization, but it was still a major shift in a direction I didn't want to go.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Angular was too cold.&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  VUE
&lt;/h1&gt;

&lt;p&gt;Vue was the new kid on the block and was inspired by AngularJS -- ok, that got my attention!  So, I got out my coding spoon and had a taste.&lt;/p&gt;

&lt;p&gt;What I like about Vue is it's easy to use for small things.  Populating a drop-down box with a data feed?  No problem.  Need a data table?  Piece of cake.  Adding search capabilities to that table?  Filters are your friends.  All of the rendered code is easily readable in good old fashioned HTML.  The JavaScript is tucked away in another file and not difficult to follow.  &lt;/p&gt;

&lt;p&gt;I found my work with AngularJS helped a lot with learning Vue, since many concepts are the same.  I also found Vue isn't as component oriented as React and Angular.  That made working in Vue more of a &lt;em&gt;step up&lt;/em&gt; from JavaScript or jQuery.  By taking a step -- not a leap -- I was able to get my hands around it quickly and really make it work!&lt;/p&gt;

&lt;p&gt;Vue does use components which is great for the DRY (Do not Repeat Yourself) principle.  It makes sense to build one component for code used in multiple screens.  When writing HTML for your Vue component, you can keep it in the script file, or you can separate it out into another file.  It's your choice -- and I like that.&lt;/p&gt;

&lt;p&gt;Because Vue is small and easy to insert anywhere, it's a good choice for upgrading existing projects gradually.  For example, an older app using jQuery can handle Vue coding.  It's easy to insert it, you don't have to refactor everything, but you will see improvements because of Vue's data binding etc.  That's an easy sell to a client as opposed to a full re-write. &lt;/p&gt;

&lt;p&gt;So, Vue is great now, but will it be here in 5 years or in the digital dustbin with AngularJS?  There's no way of knowing for sure.  Right now, it's growing in popularity but things change.  However, because most of the code is in JavaScript (in theory), you should be able to move your Vue algorithms to another platform if needed.  &lt;/p&gt;

&lt;h2&gt;
  
  
  To Sum Up
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Vue's learning curve is fairly flat.&lt;br&gt;
If you're comfortable with JavaScript, it's the next step up.  It also has good documentation and support.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Vue is flexible.&lt;br&gt;
Whether you're adding a little functionality or creating a large project, Vue is designed to handle it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Vue has a future, and if it doesn't, you still have your code.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Vue is just right.&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  CONCLUSION
&lt;/h1&gt;

&lt;p&gt;The opinions stated above are just that -- opinions -- based on my experience and point of view.  I approached each framework with an open mind and still have that openness to them.  Dogma be damned, I just want something I can use that will do the job.  Right now, Vue 'sparks joy' for me.  If you're looking for a framework, have a look at it and see what it does for you.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>javascript</category>
      <category>wecoded</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Nevertheless, Lisa Armstrong Coded</title>
      <dc:creator>Lisa Armstrong</dc:creator>
      <pubDate>Wed, 13 Mar 2019 22:04:06 +0000</pubDate>
      <link>https://forem.com/workingwebsites/nevertheless-lisa-armstrong-coded--775</link>
      <guid>https://forem.com/workingwebsites/nevertheless-lisa-armstrong-coded--775</guid>
      <description>&lt;h2&gt;
  
  
  I continued to code in 2019 because I love this stuff.  Last year I began 'getting smart' about JS6, GIT, AngularJS which lead me to VueJS which I used in a couple of project and have fully embraced.  I'm at the point now where I can really enjoy what my new skills can do.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  I want to see the tech community have critical thinking, but not critical attitudes.
&lt;/h2&gt;

</description>
      <category>wecoded</category>
    </item>
  </channel>
</rss>
