cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

wovjPE

A Pen By Captain Anonymous

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

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.

            
              <div id='app'>
  <div v-if='quotes'>
    <ul
          v-for='quote in quotes'
    >
      <li>{{ quote.id }}: {{ quote.body }}</li>
    </ul>
  </div>
  <button @click='getQuote()'>Get quote 18</button>
</div>
            
          
!
            
              Vue.use(VueResource);

/* IN OUR TESTS */
let routes = [
  {
    method: 'GET',
    url: 'quotes/',
    response: [
      {id: 14, body: "You know what the chain of command is? It's the chain I go get and beat you with until you understand who's in ruttin charge here."},
      {id: 22, body: 'Also? I can kill you with my brain.'}
    ]
  },
  {
    method: 'POST',
    url: 'quotes/',
    response: {id: 23, body: 'Terse? I can be terse. Once, in flight school, I was laconic.'}
  },
  {
    method: 'GET',
    url: 'quotes/18/',
    response: {id: 18, body: 'Curse your sudden but inevitable betrayal!'}
  }
];

Vue.http.interceptors.unshift((request, next) => {
  let route = routes.find((item) => {
    return (request.method === item.method && request.url === item.url);
  });
  if (!route) {
    // we're just going to return a 404 here, since we don't want our test suite making a real HTTP request
    next(request.respondWith({status: 404, statusText: 'Oh no! Not found!'}));
  } else {
    next(
      request.respondWith(
        route.response,
        {status: 200}
      )
    );
  }
});


/* IN OUR APPLICATION */
new Vue({
  el: '#app',
  data: {
    quotes: null
  },
  created () {
    Vue.http.get('quotes/').then((res) => {
      this.quotes = res.body;
    });
  },
  methods: {
    getQuote () {
      Vue.http.get('quotes/18/').then((res) => {
        this.quotes.push(res.body);
      });
    }
  }                         
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console