render与vue组件和注册

<template>
  <div class="about">
    <h1>This is an about page</h1>
    <component>1</component>
  </div>
</template>
<script>


  const component = {
    name: 'component',
    // template: `
    //   <div :style="style">
    //     <slot></slot>
    //   </div>
    // `,
    render (createElement) {
      return createElement('div', {
        style: this.style
      }, this.$slots.default)
    },
    data () {
      return {
        style: {
           '200px',
          height: '200px',
          border: '1px solid #aaa'
        },
        value: 'component value'
      }
    }
  }
  export default {
    components: {
      component
    }
  }
</script>

 https://www.cnblogs.com/i-want-to-be-like-an-sun/p/8041731.html

原文地址:https://www.cnblogs.com/cnchengv/p/10766723.html