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 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 id="app"></div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.min.js"></script>
              
            
!

CSS

              
                /* 表示・非表示アニメーション中 */
.v-enter-active, .v-leave-active {
  transition: all 500ms;
}

/* 表示アニメーション開始時 ・ 非表示アニメーション後 */
.v-enter, .v-leave-to {
  opacity: 0;
}

/* 要素が移動する時に700msで移動するように指定 */
.v-move {
  transition: all 700ms;
}

.v-leave-active {
  /* 移動のトランジションをさせる場合は非表示アニメーション中は position: absoluteを指定しないと正しく動作しない */
  position: absolute;
}

              
            
!

JS

              
                const App = {
  template: `
<div id="app">
    <button @click="add">ADD</button>
    <button @click="shuffle">SHUFFLE</button>
    <transition-group>
      <div v-for="(todo, index) in todos" :key="todo.key">
        <span>{{ todo.value }}</span><input @click="remove(index)" type="button" value="x" />
      </div>
    </transition-group>
  </div>
  `,
  data() {
    return {
      todos: [
        {key: 0, value: "hoge"},
        {key: 1, value: "hoge"},
        {key: 2, value: "hoge"},
        {key: 3, value: "hoge"},
        {key: 4, value: "hoge"},
        {key: 5, value: "hoge"},
      ],
      nextNum: 5
    }
  },
  methods: {
    add: function() {

      const value = 'hoge'
      const todo = {
        key: this.nextNum += 1,
        value
      }
      this.todos.push(todo)
    },
    remove: function(index) {
      this.todos.splice(index, 1)
    },
    shuffle: function () {
      this.todos = _.shuffle(this.todos)
    }
  }
  
};

new Vue({
  el: '#app',
  components: {
    App,
  },
  template: `
    <App/>
  `
});

              
            
!
999px

Console