单页面组件的<template>是怎么被获取到的?vue router用component来映射组件,比如说 component: () => import('../pages/demo'),那应该只能获取到export的内容啊。是怎么获取到<template>内容的?
<template>
<ax-button>按钮</ax-button>
</template>
<script>
export default {
name: 'Button'
}
</script>
比如这个,export根本没导出<template>相关啊,求大佬解惑
导入语法引用了
demo
文件webpack
找到demo
文件将
demo
文件内容交给vue-loader
vue-loader
将原始的vue
文件拆分为template
,js
,css
三部分template
被编译成为渲染函数放到了js
里js
和css
再分别交给babel-loader
,css-loader style-loader
处理