紫洋
紫洋
  • 发布:2020-08-05 12:58
  • 更新:2020-08-05 12:58
  • 阅读:780

【报Bug】easycom 对于组件的循环引用报错

分类:uni-app

产品分类: uniapp/H5

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 10.14.6 (18G3020)

HBuilderX类型: Alpha

HBuilderX版本号: 2.8.3

浏览器平台: Chrome

浏览器版本: 83.0.4103.116(正式版本) (64 位)

项目创建方式: HBuilderX

示例代码:

zxw-but:

<template>
<view :class="[isOnlyIcon?'onlyIcon':'']" class="zxwBut">
<template v-if="isEmpty(formType)">
<button @tap.stop="click" :loading="loadings" hover-class="click" :disabled="disableds">
<view v-if="!isEmpty(icons)&&!loadings" class="icon" :class="icons"></view>
{{text}}
</button>
</template>
<template v-else>
<button :loading="loadings" hover-class="click" :disabled="disableds">
<view v-if="!isEmpty(icons)&&!loadings" class="icon" :class="icons"></view>
{{text}}
</button>
</template>
<zxw-dialog @close="dialogClose" width="50%" height="50%" v-if="isDialog" :ref="type+'dialog'" :title="text" >
<view slot="body" >
<slot></slot>
</view>
</zxw-dialog>
</view>
</template>

<script>
import {zxw} from "../zxw/zxw.js";
import zxwComponentsMixins from "@/components/zxw/zxwComponentsMixins.js"
export default {
name: 'zxw-but',
mixins: [zxwComponentsMixins],
props: {
/**

  • 是否只显示图标
    */
    isOnlyIcon:{
    type: [Boolean],
    required: false,
    default: false
    },
    /**
  • 图标
    */
    icon: {
    type: [String],
    required: false,
    default: ''
    },
    /**
  • 文字
    */
    text: {
    type: [String],
    required: false,
    default: ''
    },
    /**
  • 是否禁用
    */
    disabled: {
    type: [Boolean],
    required: false,
    default: false
    },
    /**
  • 按钮类型
  • refresh 刷新
  • add 新增
  • modify 修改
  • record 记录
  • delete 删除
  • batchDelete 批量删除
  • execute 执行
  • import 导入
  • export 导出
  • pay 播放
  • save 保存
  • download 下载
  • look 查看
  • close 关闭
  • return 返回
    */
    type: {
    type: [String],
    required: false,
    default: ''
    },
    /**
  • 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
    */
    formType: {
    type: [String],
    required: false,
    default: ''
    },
    /**
  • 需要额外存储的数据
    */
    datas: {
    type: [Object],
    required: false,
    default: function() {
    return {}
    }
    }
    },
    watch: {
    icon: {
    handler: function(newVal) {
    if (!zxw.isEmpty(newVal)) {
    this.icons = newVal;
    }
    },
    deep: true,
    immediate: true
    },
    type: {
    handler: function(newVal) {
    this._type(newVal);
    },
    deep: true,
    immediate: true
    },
    '$slots':{
    handler: function(newVal) {
    this.isDialog = !zxw.isEmpty(newVal);
    },
    deep: true,
    immediate: true
    }
    },
    data() {
    return {
    isDialog:false,
    icons: '',
    disableds: false, //是否禁用
    loadings: false, //是否是加载等待
    iconList: {
    refresh: 'zxw-but-iconfont zxw-but-icon-shuaxin',
    return: 'zxw-but-iconfont zxw-but-icon-',
    add: 'zxw-but-iconfont zxw-but-icon-xinzeng',
    modify: 'zxw-but-iconfont zxw-but-icon-xiugai07',
    record: 'zxw-but-iconfont zxw-but-icon-jilu',
    delete: 'zxw-but-iconfont zxw-but-icon-shanchu',
    batchDelete: 'zxw-but-iconfont zxw-but-icon-piliangshanchu',
    execute: 'zxw-but-iconfont zxw-but-icon-zhihang',
    import: 'zxw-but-iconfont zxw-but-icon-daoru',
    export: 'zxw-but-iconfont zxw-but-icon-daochu',
    pay: 'zxw-but-iconfont zxw-but-icon-bofang',
    save: 'zxw-but-iconfont zxw-but-icon-baocun',
    download: 'zxw-but-iconfont zxw-but-icon-xiazai',
    look: 'zxw-but-iconfont zxw-but-icon-chakan',
    close:'zxw-but-iconfont zxw-but-icon-guanbi'
    }
    };
    },
    methods: {
    _type(newVal) {
    if (zxw.isEmpty(this.icon)) {
    this.icons = this.iconList[newVal];
    }
    },
    setDisableds(truth) {
    this.disableds = truth;
    },
    setLoadings(truth) {
    this.loadings = truth;
    },
    dialogClose(){
    this.setDisableds(false);
    this.setLoadings(false);
    },
    /**
  • 点击事件
  • @param {Object} e
    */
    click(e) {
    var truth = true;
    this.setDisableds(true);
    this.setLoadings(true);
    if(this.isDialog == true){
    this.$refs[this.type+'dialog'].show();
    return;
    }
    this.$emit('click', e, this.datas, () => {
    truth = false;
    }, () => {
    this.setDisableds(false);
    this.setLoadings(false);
    });
    console.log(truth);
    if (truth == true) {
    if (this.type == 'return') {
    //#ifdef PC-WEB
    this.$router.back();
    //#endif
    //#ifndef PC-WEB
    uni.navigateBack();
    //#endif
    this.setDisableds(false);
    this.setLoadings(false);
    } else {
    this.setDisableds(false);
    this.setLoadings(false);
    }
    }
    }
    }
    }
    </script>

<style lang="scss" scoped>
.zxwBut {
display: inline-block;
min-width: 100rpx;
border-radius: 5rpx;
padding-right: 5rpx;
padding-left: 5rpx;
box-sizing:border-box;
button {
border: 0px;
outline: 0px;
font-size: 14rpx;
border-radius: 5rpx;
&::after {
border: none;
}

        .icon {  
            font-size: 14rpx;  
            display: inline-block;  
            padding-right: 5px;  
        }  

        &.click {  
            background-color: #000000;  
        }  
    }  
    &.onlyIcon{  
        width: auto;  
        min-width: auto;  
        button{  
            background-color:transparent;  
            .icon{  
                font-size: 16rpx;  
                padding-right: 0px;  
                height: 30rpx;  
                line-height: 30rpx;  
            }  
        }  
    }  
}  

@font-face {font-family: "zxw-but-iconfont";  
  src: url('//at.alicdn.com/t/font_1985325_udwv6ht74id.eot?t=1596518912083'); /* IE9 */  
  src: url('//at.alicdn.com/t/font_1985325_udwv6ht74id.eot?t=1596518912083#iefix') format('embedded-opentype'), /* IE6-IE8 */  
  url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAqwAAsAAAAAFCgAAApiAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCFFAqXUJMNATYCJANACyIABCAFhU0HgTsb+hAjETaUk+Ij+4sDu/Hye8g7RjGwDjh5wZGpXvhTtYY6wcjiYhlEmzZ7e+gZxISoQ5OaQUUlqbhFnf+qGalc6n6TblUC7EnCytxhp96+atEhbyLQJm0ICy+26+2rlKLI/DdAAMFZt7FxpmMfs8Bb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kuhhYJJSxRETXREC3RET3hCE8EIhKJGDqw+gysad1aYJ/peC1RCwzEa/oac2S3PlB2QGe3yyXVOWMksPF5be4pcHMrBYSYV3WwR3ABLSbzaoGr+bw6EMyBVo2HCni3pZqY7qrakwkA') format('woff2'),  
  url('//at.alicdn.com/t/font_1985325_udwv6ht74id.woff?t=1596518912083') format('woff'),  
  url('//at.alicdn.com/t/font_1985325_udwv6ht74id.ttf?t=1596518912083') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */  
  url('//at.alicdn.com/t/font_1985325_udwv6ht74id.svg?t=1596518912083#zxw-but-iconfont') format('svg'); /* iOS 4.1- */  
}  

.zxw-but-iconfont {  
  font-family: "zxw-but-iconfont" !important;  
  font-size: 16px;  
  font-style: normal;  
  -webkit-font-smoothing: antialiased;  
  -moz-osx-font-smoothing: grayscale;  
}  

.zxw-but-icon-guanbi:before {  
  content: "\e6a6";  
}  

.zxw-but-icon-ffanhui-:before {  
  content: "\e6b1";  
}  

.zxw-but-icon-shuaxin:before {  
  content: "\e661";  
}  

.zxw-but-icon-xinzeng:before {  
  content: "\e623";  
}  

.zxw-but-icon-xiugai07:before {  
  content: "\e738";  
}  

.zxw-but-icon-jilu:before {  
  content: "\e66b";  
}  

.zxw-but-icon-shanchu:before {  
  content: "\e78d";  
}  

.zxw-but-icon-zhihang:before {  
  content: "\e62f";  
}  

.zxw-but-icon-daoru:before {  
  content: "\e621";  
}  

.zxw-but-icon-bofang:before {  
  content: "\e662";  
}  

.zxw-but-icon-baocun:before {  
  content: "\e605";  
}  

.zxw-but-icon-daochu:before {  
  content: "\e600";  
}  

.zxw-but-icon-xiazai:before {  
  content: "\e618";  
}  

.zxw-but-icon-chakan:before {  
  content: "\e67f";  
}  

.zxw-but-icon-piliangshanchu:before {  
  content: "\e624";  
}  

</style>

zxw-dialog:

<template>
<view @tap="close()" v-if="!isClose" class="zxwDialog" >
<view :animation="getChangeShowAnimation()" @transitionend="transitionend" :style="{height:height,width:width}" :class="[type]" class="dialogBody" >
<view @tap.stop class="head" >
<slot name="head" >
<view class="title" >
{{title}}
</view>
<view class="bottoms" >
<zxw-dialog-but @click.stop="close" class="buts" type="close" :isOnlyIcon="true" ></zxw-dialog-but>

                </view>  
            </slot>  
        </view>  
        <view @tap.stop class="body" >  
            <zxw-chunk-loading :isShow="isShowLoading" ></zxw-chunk-loading>  
            <view v-if="isEndAnimClose" class="bodySlot" >  
                <slot name="body" ></slot>  
            </view>  
        </view>  
        <view @tap.stop class="bottom" >  
            <slot name="bottom" >  
                <zxw-dialog-but @click="close" class="close" type="close" text="关闭" ></zxw-dialog-but>  
            </slot>  
        </view>  
    </view>  
</view>  

</template>

<script>
import {zxw} from "../zxw/zxw.js";
import zxwComponentsMixins from "@/components/zxw/zxwComponentsMixins.js"
export default {
name:'zxw-dialog',
mixins: [zxwComponentsMixins],
props:{
/**

  • 标题
    */
    title:{
    type: [String],
    required: false,
    default: ""
    },
    /**
  • 最大高度
    */
    height:{
    type: [String],
    required: false,
    default: "100%"
    },
    /**
  • 点击背景是否关闭
    */
    clickBgClose:{
    type: [Boolean],
    required: false,
    default: true
    },
    /**
  • 显示方式
  • center 居中
  • left 左
  • top 顶部
  • right 右侧
  • bottom 底部
    */
    type:{
    type: [String],
    required: false,
    default: "center"
    },
    /**
  • 宽度
    */
    width:{
    type: [String],
    required: false,
    default: "100%"
    }
    },
    computed:{
    getChangeShowAnimation:function(){
    return function(){
    var animation = uni.createAnimation({
    duration: 400,
    timingFunction: 'ease',
    });
    if(this.isAnimClose == true){
    if(this.type=='center'){
    animation.opacity(0).translateY('-55%').translateX('-50%').step();
    }
    }else{
    if(this.type=='center'){
    animation.opacity(1).translateY('-50%').translateX('-50%').step();
    }
    }
    var dh = animation.export();
    return dh;
    }
    }
    },
    data() {
    return {
    isClose:true,//是否已关闭
    isAnimClose:false,//执行关闭动画
    isEndAnimClose:false,//动画已执行完毕
    isShowLoading:true,//是否显示body的loading效果
    };
    },
    methods:{
    transitionend(){
    console.log('执行关闭');
    if(this.isAnimClose == true){
    this.isClose = true;
    this.$emit('close',this);
    }else{
    this.$emit('show',this);
    }
    this.isEndAnimClose = true;
    this.$nextTick(()=>{
    this.isShowLoading = false;//关闭loading
    })
    },
    show(){
    this.isEndAnimClose = false;
    this.isShowLoading = true;
    this.$nextTick(()=>{
    this.isAnimClose = false;
    this.isClose = false;
    });
    },
    close:function(){
    this.isEndAnimClose = false;
    this.isAnimClose = true;
    this.isShowLoading = true;
    this.$emit('closeing',this);
    }
    }
    }
    </script>

<style lang="scss" scoped>
.zxwDialog{
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index: 99999;
.dialogBody{
background-color: white;
display: flex;
flex-direction: column;
background-color: #fff;
opacity: 0;
border-radius: 2px;
box-shadow: 1px 1px 50px rgba(0,0,0,0.3);
&.center{
transform: translate(-50%, -60%);
top: 50%;
left: 50%;
position: fixed;
}
.head{
padding: 5rpx 10rpx;
height: 30rpx;
display: flex;
background-color: #F8F8F8;
.title{
flex: 1;
line-height: 30rpx;
}
.bottoms{
.buts:last-child{
/deep/ button{
padding-right: 0rpx;
}
}
}
}
.body{
flex: 1;
position: relative;
box-sizing: border-box;
.bodySlot{
padding: 10rpx;
}
}
.bottom{
text-align: right;
padding: 10rpx;
height: 30px;
.close{
background-color: red;
/deep/ button{
background-color: red;
color: #FFFFFF;
}
}
}
}
}
</style>

zxw-dialog-but:

<template>
<view :class="[isOnlyIcon?'onlyIcon':'']" class="zxwBut">
<template v-if="isEmpty(formType)">
<button @tap.stop="click" :loading="loadings" hover-class="click" :disabled="disableds">
<view v-if="!isEmpty(icons)&&!loadings" class="icon" :class="icons"></view>
{{text}}
</button>
</template>
<template v-else>
<button :loading="loadings" hover-class="click" :disabled="disableds">
<view v-if="!isEmpty(icons)&&!loadings" class="icon" :class="icons"></view>
{{text}}
</button>
</template>
<zxw-dialog @close="dialogClose" width="50%" height="50%" v-if="isDialog" :ref="type+'dialog'" :title="text" >
<view slot="body" >
<slot></slot>
</view>
</zxw-dialog>
</view>
</template>

<script>
import {zxw} from "../zxw/zxw.js";
import zxwComponentsMixins from "@/components/zxw/zxwComponentsMixins.js"
export default {
name: 'zxw-dialog-but',
mixins: [zxwComponentsMixins],
props: {
/**

  • 是否只显示图标
    */
    isOnlyIcon:{
    type: [Boolean],
    required: false,
    default: false
    },
    /**
  • 图标
    */
    icon: {
    type: [String],
    required: false,
    default: ''
    },
    /**
  • 文字
    */
    text: {
    type: [String],
    required: false,
    default: ''
    },
    /**
  • 是否禁用
    */
    disabled: {
    type: [Boolean],
    required: false,
    default: false
    },
    /**
  • 按钮类型
  • refresh 刷新
  • add 新增
  • modify 修改
  • record 记录
  • delete 删除
  • batchDelete 批量删除
  • execute 执行
  • import 导入
  • export 导出
  • pay 播放
  • save 保存
  • download 下载
  • look 查看
  • close 关闭
  • return 返回
    */
    type: {
    type: [String],
    required: false,
    default: ''
    },
    /**
  • 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
    */
    formType: {
    type: [String],
    required: false,
    default: ''
    },
    /**
  • 需要额外存储的数据
    */
    datas: {
    type: [Object],
    required: false,
    default: function() {
    return {}
    }
    }
    },
    watch: {
    icon: {
    handler: function(newVal) {
    if (!zxw.isEmpty(newVal)) {
    this.icons = newVal;
    }
    },
    deep: true,
    immediate: true
    },
    type: {
    handler: function(newVal) {
    this._type(newVal);
    },
    deep: true,
    immediate: true
    },
    '$slots':{
    handler: function(newVal) {
    this.isDialog = !zxw.isEmpty(newVal);
    },
    deep: true,
    immediate: true
    }
    },
    data() {
    return {
    isDialog:false,
    icons: '',
    disableds: false, //是否禁用
    loadings: false, //是否是加载等待
    iconList: {
    refresh: 'zxw-but-iconfont zxw-but-icon-shuaxin',
    return: 'zxw-but-iconfont zxw-but-icon-',
    add: 'zxw-but-iconfont zxw-but-icon-xinzeng',
    modify: 'zxw-but-iconfont zxw-but-icon-xiugai07',
    record: 'zxw-but-iconfont zxw-but-icon-jilu',
    delete: 'zxw-but-iconfont zxw-but-icon-shanchu',
    batchDelete: 'zxw-but-iconfont zxw-but-icon-piliangshanchu',
    execute: 'zxw-but-iconfont zxw-but-icon-zhihang',
    import: 'zxw-but-iconfont zxw-but-icon-daoru',
    export: 'zxw-but-iconfont zxw-but-icon-daochu',
    pay: 'zxw-but-iconfont zxw-but-icon-bofang',
    save: 'zxw-but-iconfont zxw-but-icon-baocun',
    download: 'zxw-but-iconfont zxw-but-icon-xiazai',
    look: 'zxw-but-iconfont zxw-but-icon-chakan',
    close:'zxw-but-iconfont zxw-but-icon-guanbi'
    }
    };
    },
    methods: {
    _type(newVal) {
    if (zxw.isEmpty(this.icon)) {
    this.icons = this.iconList[newVal];
    }
    },
    setDisableds(truth) {
    this.disableds = truth;
    },
    setLoadings(truth) {
    this.loadings = truth;
    },
    dialogClose(){
    this.setDisableds(false);
    this.setLoadings(false);
    },
    /**
  • 点击事件
  • @param {Object} e
    */
    click(e) {
    var truth = true;
    this.setDisableds(true);
    this.setLoadings(true);
    if(this.isDialog == true){
    this.$refs[this.type+'dialog'].show();
    return;
    }
    this.$emit('click', e, this.datas, () => {
    truth = false;
    }, () => {
    this.setDisableds(false);
    this.setLoadings(false);
    });
    console.log(truth);
    if (truth == true) {
    if (this.type == 'return') {
    //#ifdef PC-WEB
    this.$router.back();
    //#endif
    //#ifndef PC-WEB
    uni.navigateBack();
    //#endif
    this.setDisableds(false);
    this.setLoadings(false);
    } else {
    this.setDisableds(false);
    this.setLoadings(false);
    }
    }
    }
    }
    }
    </script>

<style lang="scss" scoped>
.zxwBut {
display: inline-block;
min-width: 100rpx;
border-radius: 5rpx;
padding-right: 5rpx;
padding-left: 5rpx;
box-sizing:border-box;
button {
border: 0px;
outline: 0px;
font-size: 14rpx;
border-radius: 5rpx;
&::after {
border: none;
}

        .icon {  
            font-size: 14rpx;  
            display: inline-block;  
            padding-right: 5px;  
        }  

        &.click {  
            background-color: #000000;  
        }  
    }  
    &.onlyIcon{  
        width: auto;  
        min-width: auto;  
        button{  
            background-color:transparent;  
            .icon{  
                font-size: 16rpx;  
                padding-right: 0px;  
                height: 30rpx;  
                line-height: 30rpx;  
            }  
        }  
    }  
}  

@font-face {font-family: "zxw-but-iconfont";  
  src: url('//at.alicdn.com/t/font_1985325_udwv6ht74id.eot?t=1596518912083'); /* IE9 */  
  src: url('//at.alicdn.com/t/font_1985325_udwv6ht74id.eot?t=1596518912083#iefix') format('embedded-opentype'), /* IE6-IE8 */  
  url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAqwAAsAAAAAFCgAAApiAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCFFAqXUJMNATYCJANACyIABCAFhU0HgTsb+hAjETaUk+Ij+4sDu/Hye8g7RjGwDjh5wZGpXvhTtYY6wcjiYhlEmzZ7e+gZxISoQ5OaQUUlqbhFnf+qGalc6n6TblUC7EnCytxhp96+atEhbyLQJm0ICy+26+2rlKLI/DdAAMFZt7FxpmMfs8BbtrrM71zilSLeOek/78ROzkl8wzklzo0nsICXgaICVsT619ybRRYOtxhXYTq16u3+FF52A5sSkANUrWahySdldqRaWWHhfE/Z0/b8Zz/3HGgNCK/uCtdGe3327gYCQA8TokGsjVp0gBYspEYwaNjglL7QJvLAZkQTaA214UwWJAMqaJnFzAUA6d73k9cwEy3AQEUhj2yTbBuAejIqU+ksZRZ6kBfU5koA7M4DKIBoACxArhjLzoEGGO1xvWkkizIAPjCI5/IyZJXsIQfIwXKc3E8eKs+UV8lbK6tVpioKQIZ3UKZ9JyerCHyUtymj/2kADw4CdGAhQTugVjVEkHH/z4MGIGoIzsP/RLsEyNAK8ICsUoADZA8FBEAOUEAHyEEKsIAc7GlCxEFCC9EXEhSiHyT0EEMhoYaYCQkRYhUkCMRWKMAAldUkVJ5IRSk0kNxAZ/gDqAHQUwD7ENCHeZxZ9Z4ULNRQgSmAr26YOqEQZbSwMCLLXvmcNFgc9I8cRShfkMXRQpcs95SMEtlGN3cuSZKaX9Yty9PduoKr7iX28x9/Pg+nnv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GXirBMgThZDDSZ0V0BQHlMp1BT4EqPM3cBJZdW0k5e7Cy6hs6yjlA1ux7aNtIbzNsqPvYUymm6kdbCXfBu1vZhoIamoo8w6zsO0OPU+jOyF9pbDuzvLdX6quX+s6y739pJEbXKrE1Od63QYshyAj8aasFZ7DVb5Bt2nhntaSzeINpoYQB6tQD4uahy8tel7lqYERoS6o4wNEIIZXDkzfo/ERVOC6Jm8En0orjzOc6+UGQ6AJG+GSH8/RKG6D2h/P17seEdEhW3nlFt8n8lep1KV+SE9oMaRgTBQulRkQlsHwfI5nzoj3WW46eNvqDLNcR3456+8gNjosDq/OTsfecMGWMXx6TOXYhYZWNo1PR+P6zroNoYSjRy4kXah9NTazr2xIRmsqmhCAGhlAVFG9MTI2D2eLFpikHvmJaJN27mn/cCOVkNxIJTuoz9gKKErtunnDtxVsF7xrnSuFPpmXScC94iLKUxio6GMt0DsFZtgdKadyshQ5zwFVpaD075fLYoP+leb74pjo97QvkuhhYJJSxRETXREC3RET3hCE8EIhKJGDqw+gysad1aYJ/peC1RCwzEa/oac2S3PlB2QGe3yyXVOWMksPF5be4pcHMrBYSYV3WwR3ABLSbzaoGr+bw6EMyBVo2HCni3pZqY7qrakwkA') format('woff2'),  
  url('//at.alicdn.com/t/font_1985325_udwv6ht74id.woff?t=1596518912083') format('woff'),  
  url('//at.alicdn.com/t/font_1985325_udwv6ht74id.ttf?t=1596518912083') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */  
  url('//at.alicdn.com/t/font_1985325_udwv6ht74id.svg?t=1596518912083#zxw-but-iconfont') format('svg'); /* iOS 4.1- */  
}  

.zxw-but-iconfont {  
  font-family: "zxw-but-iconfont" !important;  
  font-size: 16px;  
  font-style: normal;  
  -webkit-font-smoothing: antialiased;  
  -moz-osx-font-smoothing: grayscale;  
}  

.zxw-but-icon-guanbi:before {  
  content: "\e6a6";  
}  

.zxw-but-icon-ffanhui-:before {  
  content: "\e6b1";  
}  

.zxw-but-icon-shuaxin:before {  
  content: "\e661";  
}  

.zxw-but-icon-xinzeng:before {  
  content: "\e623";  
}  

.zxw-but-icon-xiugai07:before {  
  content: "\e738";  
}  

.zxw-but-icon-jilu:before {  
  content: "\e66b";  
}  

.zxw-but-icon-shanchu:before {  
  content: "\e78d";  
}  

.zxw-but-icon-zhihang:before {  
  content: "\e62f";  
}  

.zxw-but-icon-daoru:before {  
  content: "\e621";  
}  

.zxw-but-icon-bofang:before {  
  content: "\e662";  
}  

.zxw-but-icon-baocun:before {  
  content: "\e605";  
}  

.zxw-but-icon-daochu:before {  
  content: "\e600";  
}  

.zxw-but-icon-xiazai:before {  
  content: "\e618";  
}  

.zxw-but-icon-chakan:before {  
  content: "\e67f";  
}  

.zxw-but-icon-piliangshanchu:before {  
  content: "\e624";  
}  

</style>

操作步骤:

1、先使用zxw-dialog中引用zxw-but组件
2、zxw-but中打开zxw-dialog后报错

预期结果:

能相互引用

实际结果:

不能相互引用

bug描述:

两个组件,一个叫zxw-dialog 另一个叫zxw-but 在zxw-dialog中引用zxw-but zxw-but 中也引用了zxw-dialog 但是打开zxw-dialog后报错找不到zxw-but 在其他地方正常使用zxw-but没有问题,然后将zxw-but换一个名字,如zxw-dialog-but之后,在zxw-dialog中引用zxw-dialog-but没有问题

2020-08-05 12:58 负责人:无 分享
已邀请:

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