Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Including one Vue.js component in an existing HTML page</title>
  <link href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap" rel="stylesheet">
</head>
<body>
  <h1>This is standard HTML</h1>
  <div id="components-demo" class="components-demo">
    <h3>Here is some content generated with Vue</h3>
    <editable-text></editable-text>
  </div>
  <p>This paragraph is normal HTML content. Not interactive, server-side generated.</p>
  
  <div id="components-demo2"  class="components-demo">
    <h3>Here is some other content generated with Vue</h3>
    <my-counter></my-counter>
  </div>
</body>
</html>

              
            
!

CSS

              
                body {
  font-family: 'Open Sans', sans-serif;
  color: #0c0c0c;
  background: #eeeeee;
}
.components-demo {
  border: 1px dashed lightgrey;
  padding: 10px;
}
              
            
!

JS

              
                // Create a first component <my-counter>

Vue.component('editable-text', {
  data: function () {
    return {
      message: "Change me"
    }
  },
  template: `<div><p>Message is: {{ message }}</p>
<input v-model="message" placeholder="edit me" /></div>`
})


// activate Vue on the <div> that contains the component

new Vue({ el: '#components-demo' })

// Create a second component
Vue.component('my-counter', {
  data: function () {
    return {
      count: 0
    }
  },
  template: `<button v-on:click="count++">You have clicked {{ count }} times.</button>
`
})

// activate a Vue instance on the <div> that contains the component

new Vue({ el: '#components-demo2' })
              
            
!
999px

Console