特洛伊
特洛伊
  • 发布:2018-11-30 19:31
  • 更新:2018-12-06 11:35
  • 阅读:2444

【报Bug】uni-app热编译时组件中slot分发出错,不支持三级引入

分类:uni-app

[内容]
带<slot></slot>的组件,不能被三级引用, 比如我在a.vue引用了b.vue, 而b.vue又引用了c.vue组件, c.vue里有<slot>占坑符, 那么就会出现,首次运营到微信开发工具的时候没有问题,然后修改b.vue中所填c.vue中<slot>的内容时,保存后就会出错,提示找不到template

举例:
再项目中新建base.vue作为入口文件
在base.vue中引入自定义组件topbar.vue

import topbar from '../public_component/topbar/topbar.vue'

然后在topbar.vue里又引入了官方组件:抽屉

<uni-drawer :visible="rightDrawerVisible" mode="right" @close="closeRightDrawer">  
	<view>1111</view>	  
</uni-drawer>  
import uniDrawer from '../../../components/uni-drawer.vue'

uni-drawer.vue的内容是这样的:

<template>  
	<view class="uni-drawer" :catchtouchmove="catchtouchmove" :class="{'uni-drawer-visible':visible,'uni-drawer-right':rightMode}">  
		<view v-if="showMask" class="uni-drawer-mask" @tap="close"></view>  
		<view class="uni-drawer-content">  
			<slot></slot>  
		</view>  
	</view>  
</template>

现象是:
首次编译一切ok
只要修改topbar.vue里<uni-drawer>里的内容保存,微信开发者工具里,就会报错:template NOT Found.(如图)

2018-11-30 19:31 负责人:无 分享
已邀请:
Trust

Trust - 少说废话

的确存在此问题,需要优化一下运行时的编译。

斗城小旋风

斗城小旋风 - 不敢想象

发布后有影响没,我也遇到这样的问题

该问题目前已经被锁定, 无法添加新回复