关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、3102411850 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 7607|回复: 4

一直显示组件未注册,请大佬帮忙看看!

[复制链接]
发表于 2019-7-22 08:51:47 | 显示全部楼层 |阅读模式
[Vue warn]: Unknown custom element: <test_modal> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
发表于 2019-7-22 11:40:10 | 显示全部楼层
描述太简单
 楼主| 发表于 2019-7-23 14:59:26 | 显示全部楼层
<template>
  <div><a-button type="primary">确定</a-button></div>
</template>

<script>
  import moment from 'moment'
  import Vue from 'vue'
  import { ACCESS_TOKEN } from '@/store/mutation-types'

  export default {
    name: 'TestModal',
    data() {
      return {
        headers: {},
        //form: this.$form.createForm(this),
        drawerWidth:700,
        visible: false
      }
    },
    created() {
      const token = Vue.ls.get(ACCESS_TOKEN)
      this.headers = { 'X-Access-Token': token }
      console.log("created")
    },
    methods: {
      show:function() {
        console.log("show");
        this.visible=true;
      }
    }
  }
</script>

<style scoped>

</style>
以上是我写的一个组件

在UserList.vue里调用
    <test_modal ref="testModal"></test_modal>
import UserModal from './modules/UserModal'
components: {
      SysUserAgentModal,
      UserModal,
      PasswordModal,
      TestModal
    },
都 有了
调用方法:
   this.$refs.testModal.show();
但是显示那个错误。
 楼主| 发表于 2019-7-24 14:14:13 | 显示全部楼层
admin_jh9 发表于 2019-7-22 11:40
描述太简单

  看看呢!
 楼主| 发表于 2019-7-25 08:47:12 | 显示全部楼层
自己搞定了,原因是<test_modal ref="testModal"></test_modal>这句里的下划线错了,应该是中划线。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表