Vue 推荐在绝大多数情况下使用 template 来创建你的 HTML。然而在一些场景中,你真的需要 JavaScript 的完全编程的能力,这时你可以用 render 函数,它比 template 更接近编译器。
我这里,举一个简单的例子。在iviews
中使用自定义DButton
组件。
特别需要注意的是组件命名按照PascalCase
格式。
1、在目录components
中新建文件DButton.vue
2、使用到的地方,进行引入:
import DButton from '@/components/button/DButton'
components: {DButton},
3、调用的时候
return <div class="table-btn-two"><DButton></DButton></div>