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">
  名前:<input type="text" v-model="name" />
  <p>※↑監視プロパティ watchは反応するが、<br>     算出プロパティ computedは反応しない。</p>

<!-- customMessageを画面から切り離す -->
<!-- <div class="">{{customMessage}}</div> -->

  <!-- データ確認用 -->
  <pre>{{$data}}</pre>
</div>
<!-- vueの読み込み -->
<script src="https://unpkg.com/vue@next"></script>
              
            
!

CSS

              
                
              
            
!

JS

              
                // Vueの宣言
Vue.createApp({
  data() {
    return { name: "サメハック" };
  },watch:{
    // nameの値を監視
    name(newValue, oldValue){
      alert(oldValue + " → " + newValue + "\n watchが反応しました");
    }
  },
  computed: {
    // 算出プロパティ
    customMessage(newValue) {
      // 画面と連携していないので、実行されない
      alert(newValue.name + "\n computedが反応しました!");
      // ↓this.nameが監視される
      return "こんにちは、" + this.name + "です!";
    },
  },
}).mount("#app");
              
            
!
999px

Console