Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="app">
  <div class="container">
    <div class="row pen-title">
      <div class="col">
        <h3 class="title">{{title}}</h3>
      </div>
      <div class="col col-auto align-self-center text-right">
        <div class="input-group">
          <div class="input-group-prepend">
            <label class="input-group-text" for="inputGroupSelect01"># of People</label>
          </div>
          <input class="form-control" type="text" v-model='quantity'>
          <div class="input-group-append">
            <button class="btn btn-primary" v-on:click="getPeople">Refresh List</button>
          </div>
        </div>
      </div>
    </div>

    <transition-group name="fade" tag="div" class="row">
      <div v-for="(person, key) in people" :key="key" class="col-md-6 col-lg-4">
        <div class="person">
          <div class="person__header">
            <img v-bind:src="person.picture.large" v-bind:alt="person" class="rounded img-thumbnail">
            <div class="person__name">{{person.name.first}} {{person.name.last}}</div>
          </div>
          <div class="person__email">
            <a v-bind:href="'mailto:' + person.email">{{person.email}}</a>
          </div>
          <div class="person__address">
            <address>
              {{person.location.street.number}}
              {{person.location.city}}
              {{person.location.state}}
            </address>
          </div>
          <div class="person__map">
            <iframe width="100%" height="170" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" v-bind:src="'https://maps.google.com/maps?q=' + person.location.coordinates.latitude +',' + person.location.coordinates.longitude + '&z=7&amp;output=embed'">
            </iframe>
          </div>
        </div>
      </div>
    </transition-group>

  </div>
</div>
              
            
!

CSS

              
                body {
  background: radial-gradient(ellipse at center, #b5bdc8 0%, #828c95 36%, #28343b 100% );
  min-height:600px;
}

.fade-enter-active, .fade-leave-active {
  transition: opacity 1s;
}
.fade-enter, .fade-leave-to {
  opacity: 0;
}

.pen-title {
  margin: 36px 0;
  color: #fff;
  padding-bottom: 36px;
  border-bottom: 1px solid #999;
  
  .title{
    text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.7);
  }
}

.person {
  background: radial-gradient(ellipse at center, #ffffff 0%, #e5e5e5 100%);
  border: 1px solid #666;
  border-radius: 4px;
  margin-bottom: 30px;
  text-align: center;
  box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);

  &__header {
    font-size: 24px;
    text-transform: capitalize;
    margin: 15px 0 30px;
  }

  &__map {
    background: white;
    border: 2px solid #88b5de;
    border-radius: 5px;
    padding: 5px 5px 0;
    margin: 0 15px 15px;
  }
}

              
            
!

JS

              
                (function(){
  var endpoint = "https://randomuser.me/api/?results="

  var app = new Vue ({
    el: '#app',
    data: {
      title:"RandomUser.me / Vue.js / Axios",
      people: [],
      quantity: 6
    },
    methods: {
      getPeople: function () { 
        // ** axios requires a promise polyfill for ie11 **//
        axios.get(endpoint + this.quantity)
          .then((rsp)=>this.people = rsp.data.results)

      //**normal XMLHttpRequest **//
        // var url = endpoint + this.quantity;
        // var request = new XMLHttpRequest();
        // request.open("GET", url);
        // request.responseType = 'json';
        // request.send();
        // request.onload = ()=> this.people = request.response.results;
      }
    },
    created: function () {
      this.getPeople();
    }
  });

})()


              
            
!
999px

Console