vx-ui icon indicating copy to clipboard operation
vx-ui copied to clipboard

递归组件调用,name参数问题

Open huanhuanhome opened this issue 5 years ago • 4 comments

我希望

流畅的使用这个Layout 布局

实际情况

在我全局引入 注册组件之后,总是在使用了 这个组件的页面中会在控制台 有报错提示。

报错信息如下 :

[Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <Detail> at src/components/get-drive/detail.vue <App> at src/App.vue <Root>

我的代码

main.js

import Vue from 'vue'
import App from './App'
import router from './router'
// import uni from './util/uni.webview.0.1.52'

var uni =require('./util/uni.webview.0.1.52')

console.log(uni)
import 'vx-ui/lib/style/theme/index.css'
import VxUI from 'vx-ui'
 Vue.use(VxUI)

Vue.config.productionTip = false

Vue.prototype.$uni=uni.uni
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})

报错的组件

<template>
 <layout>
   <div slot="header">
     <x-nav :isBack="false" :title="nav_title">
       <button class="btn-pull" slot="pull">我的</button>
     </x-nav>
   </div>
   <x-body slot="body" style="padding: 0 0.3rem;" name="">
     <group title="租赁业务">
       <div class="custom-business-list">
         <router-link class="business-list-item" to="get-drive">
           <div>取设备</div>
         </router-link>
         <router-link class="business-list-item" to>
           <div>还设备</div>
         </router-link>
         <router-link class="business-list-item" to>
           <div>查订单</div>
         </router-link>
         <router-link class="business-list-item" to>
           <div>管库存</div>
         </router-link>
       </div>
     </group>
     <group title="零售业务">
       <div class="custom-business-list">
         <router-link class="business-list-item" to>
           <div>客户自提</div>
         </router-link>
         <router-link class="business-list-item" to>
           <div>查订单</div>
         </router-link>
         <router-link class="business-list-item" to>
           <div>管库存</div>
         </router-link>
       </div>
     </group>
   </x-body>
 </layout>
</template>
<script>
import py from "./../util/py.js";
export default {
 data() {
   return {
     nav_title: "北京T2触发"
   };
 },
 mounted() {
   console.log(py);
   var aa = py.getPinYinFirstCharacter("阿里福尼亚", ",", false).split(",")[0];
   console.log(aa);
 }
};
</script>
<style >
.vx-group {
 text-align: left;
 /* margin:0 0 0.25rem 0 */
}
.custom-business-list {
 height: calc(160px + 0.6rem);
 padding: 0.2rem;
 display: flex;
 align-items: center;
 width: 100%;
 justify-content: space-between;
 align-content: space-between;
 flex-wrap: wrap;
 box-sizing: border-box;
}
.custom-business-list .business-list-item {
 height: 80px;
 background: #007ACC;
 border-radius: 10px;
 color:#fff;
 width: calc(50% - 0.1rem);
 display: flex;
 flex-direction: column;
 align-items: center;
 justify-content: center;
}
</style>

尝试

1.我尝试了在 没有办法解决。 2.尝试了

import {XBody} from 'vx-ui'

export default {
  components:{
      XBody,
    },

都没能解决这个问题, 希望可以有办法解决这个问题。

huanhuanhome avatar Apr 02 '19 05:04 huanhuanhome

没有name 属性的

yunfeihuang avatar Apr 29 '19 04:04 yunfeihuang

XBody没有纳入vx-ui组件库的

yunfeihuang avatar May 05 '19 04:05 yunfeihuang

XBody没有纳入VX-UI组件库的

那这个报错需要怎么解决呢?

huanhuanhome avatar May 06 '19 04:05 huanhuanhome

XBody没有纳入VX-UI组件库的

那这个报错需要怎么解决呢?

不要用x-body组件就可以吧

yunfeihuang avatar May 10 '19 07:05 yunfeihuang