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

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.

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 class="container" id="app">

  <div class="row">
    <div class="col-xs-12">
      <span class="label label-primary">v-model</span> Basic Usage Handlers     
    </div>
    <div class="col-xs-12 form-inline">
      <label for="input1">Write something down:</label>
      <input id="input1" class="form-control" type="text" v-model="textInput1Content">
      &nbsp;<span>And the reverse is: {{ reverseTextInput1Content }}</span>
    </div>
    <div class="col-xs-12">
      Write some code below:
    </div>
    <div class="col-xs-6">
      <textarea class="col-xs-12 form-control" v-model="textareaContent"></textarea>
    </div>
    <div class="col-xs-6">
      <pre>{{ textareaContent }}</pre>
    </div>
    <div class="col-xs-12">
      <b>How to spell "🐕" in English ?</b>
    </div>
    <div class="col-xs-12">
      <input type="checkbox" id="letterO" value="O" v-model="dogLetters">
      <label for="letterO">O</label>
      <input type="checkbox" id="letterG" value="G" v-model="dogLetters">
      <label for="letterG">G</label>
      <input type="checkbox" id="letterD" value="D" v-model="dogLetters">
      <label for="letterD">D</label>
    </div>
    <div class="col-xs-12">{{ checkDogLetters() }}</div>
    <div class="col-xs-12">
      <b>Which fruit do you like ?</b>
    </div>
    <div class="col-xs-12">
      <select class="form-control" v-model="selectedFruits" multiple>
        <option value="Apple">🍎</option>
        <option value="Pear">🍐</option>
        <option value="Banana">🍌</option>
      </select>
    </div>
    <div class="col-xs-12">You like: {{ selectedFruits }}</div>
  </div>
  
  <div class="row">
    <div class="col-xs-12">
      <span class="label label-primary">v-model</span> Value Bindings     
    </div>
    
    <div class="col-xs-12">
      <label>Do you like my code ?</label>
      <input type="checkbox" v-model="toggleLike" v-bind:true-value="like" v-bind:false-value="dislike"> {{ toggleLike }}
    </div>
    
  </div>
  
  <div class="row">
    <div class="col-xs-12">
      <span class="label label-primary">v-model</span> Modifiers   
    </div>
    
    <div class="col-xs-12 form-inline">
      <label for="textInput2">You can't change the message until you press on enter:</label>&nbsp;
      <input class="form-control" id="textInput2" type="text" v-model.lazy="msg" >
      {{ msg }}
    </div>
    
    <div class="col-xs-12 form-inline">
      <label for="workdays">How many working days you have in a week?</label>
      <input class="form-control" id="workdays" v-model.number="workdays" type="number">
      {{ workdays }} day(s) (type: {{ typeOfWorkdays }})
    </div>
    
  </div>
  
  
</div>

              
            
!

CSS

              
                .container {
  margin-top:20px;
  font-size: 20px;
  font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
  
  .row {
    margin-bottom: 10px;
    
    .col-xs-12 {
      margin-bottom: 10px;
    }
  }  
  
}


              
            
!

JS

              
                let app = new Vue({
  el: '#app',
  data: {
    textInput1Content: 'Whatever...',
    textareaContent: '',
    dogLetters: [],
    selectedFruits: [],
    toggleLike: '❤️',
    like: '❤️',
    dislike: '💔',
    msg: '',
    workdays: 0,
  },
  methods: {
    checkDogLetters: function() {
      if (0 === this.dogLetters.length) {
        return 'You need to choose the checkbox above.'; 
      } else if (3 > this.dogLetters.length) {
        return 'Not empty letters.'         
      } else {
        if (_.isEqual(this.dogLetters, ['D', 'O', 'G'])) {
          return 'Good 🐶'
        } else if (_.isEqual(this.dogLetters, ['G', 'O', 'D'])) {
          return "🙅 No, that's 🙏🙏🙏"
        } else {
          return "🙅 No, I don't know what are you talking about."         
        }
      }
    }
  },
  computed: {
    reverseTextInput1Content: function() {
      return this.textInput1Content.split('').reverse().join('')
    },
    typeOfWorkdays: function() {
      return typeof this.workdays
    }
  }
})

              
            
!
999px

Console