Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
huanhuanhome opened this issue Apr 2, 2019 · 4 comments
Open

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

huanhuanhome opened this issue Apr 2, 2019 · 4 comments

Comments

@huanhuanhome
Copy link

huanhuanhome commented Apr 2, 2019

我希望

流畅的使用这个Layout 布局

实际情况

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

报错信息如下 :

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

found in

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

我的代码

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,
    },

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

@yunfeihuang
Copy link
Owner

没有name 属性的

@yunfeihuang
Copy link
Owner

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

@huanhuanhome
Copy link
Author

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

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

@yunfeihuang
Copy link
Owner

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants