Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
<body>
  <div id="app">
    <my-component tag-name="li" repeat="5" title="Some title"></my-component>
  </div>
<script>
  window.app = new Vue({
    el: "#app",
    components: [ 
      Vue.component('my-component', {
        functional: true,
        props: ['tagName', 'title', 'repeat'],
        render: function(crtEl, ctx) {
          return crtEl(ctx.props.tagName, [
            crtEl('span', ctx.props.title), 
            crtEl('ul', 
              (function renderLI() {
                var array = [];
                for(var i = 1; i <= ctx.props.repeat ;i++  ) {
                  array.push(crtEl( 'li', 'hello!'))
                }
                return array;
              })()
            )
          ])
        }
       
      })
    ]
  });
</script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers