[Vue warn]: Unknown custom element:

html 复制代码
[Vue warn]: Unknown custom element: <experience-share> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <ProductListDialog> at src/views/tools/fake-strategy/components/product-list-dialog.vue
       <BatchVersionList> at src/views/tools/fake-strategy/components/batch-version-list.vue
         <ElDialog> at packages/dialog/src/component.vue
           <FirstAuditList> at src/views/tools/fake-strategy/components/identify-list.vue
             <TemplateList> at src/views/tools/fake-strategy/index.vue
               <AppMain> at src/layout/components/AppMain.vue
                 <Layout> at src/layout/index.vue
                   <App> at src/App.vue
                     <Root>

这个警告信息表示在ProductListDialog组件中使用的experience-share组件没有正确注册。为了修复这个问题,请确保在ProductListDialog组件中正确导入和注册ExperienceShare组件。

步骤

  1. 导入ExperienceShare组件

    ProductListDialog.vue文件中,确保导入ExperienceShare组件。

  2. 注册ExperienceShare组件

    ProductListDialog.vue文件的components选项中注册ExperienceShare组件。

修改后的代码

ProductListDialog.vue
ts 复制代码
<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator'
import { AppModule } from '@/store/modules/app'
import { productAll, productDetailSimple } from '@/api/product'
import ExperienceShare from '@/components/ExperienceShare/index.vue'

@Component({
  name: 'ProductListDialog',
  components: { ExperienceShare }
})
html 复制代码
<template>
  <div class="product-list-dialog">
    <el-dialog :visible="visible" :before-close="handleClose" :close-on-click-modal="false" title="产品列表" width="1200px" append-to-body>
      <div class="product-list-wrap">
        <div class="button-container">
          <el-button type="danger" size="mini" @click="handleAdd">添加</el-button>
        </div>
        <div class="table">
          <el-table :data="tableData" :height="tableHeight">
            <!-- 表格列 -->
          </el-table>
        </div>
        <div class="pagination space-between">
          <experience-share :type="3" />
          <el-pagination background layout="total, prev, pager, next" :current-page="parseInt(listQuery.page) + 1" :page-size="parseInt(listQuery.pageSize)" :total="parseInt(listQuery.total)" @current-change="handleCurrentChange" />
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import ExperienceShare from '@/components/ExperienceShare/index.vue'; // 确保路径正确

export default {
  name: 'ProductListDialog',
  components: {
    ExperienceShare
  },
  props: {
    visible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      tableData: [],
      listQuery: {
        page: 0,
        pageSize: 10,
        total: 0
      }
    };
  },
  computed: {
    tableHeight() {
      return Math.floor(this.$store.state.app.tableHeight * 2 / 3);
    }
  },
  methods: {
    handleClose() {
      this.$emit('update:visible', false);
    },
    handleAdd() {
      // 处理添加操作
    },
    handleCurrentChange(page) {
      this.listQuery.page = page - 1;
      // 处理页码变化
    }
  }
};
</script>

<style scoped>
/* 样式 */
</style>

确保路径正确

请确保导入路径@/components/ExperienceShare/index.vue是正确的。如果路径不正确,请根据实际文件位置调整。

通过以上修改,experience-share组件应该被正确注册和使用,从而避免出现该警告。

相关推荐
前端 贾公子8 分钟前
Eruda:移动端网页调试利器
前端·javascript·vue.js
Hashan18 分钟前
Elpis:抽离业务代码,发布NPM包
前端·javascript·vue.js
用户479492835691526 分钟前
0.1加0.2为什么不等于0.3-答不上来的都挂了
前端·javascript·面试
rit843249927 分钟前
C#实现的远程控制系统
前端·javascript·c#
南山安35 分钟前
React学习:Vite+React 基础架构分析
javascript·react.js·面试
JS_GGbond40 分钟前
JavaScript事件循环:餐厅里的“宏任务”与“微任务”
开发语言·javascript·ecmascript
脾气有点小暴1 小时前
uniapp开发APP 内嵌外部 HTTPS 链接的实现方案
vue.js·uni-app
CodeCraft Studio1 小时前
JavaScript图表库 DHTMLX Diagram 6.1 重磅发布:全新PERT模式上线,项目可视化能力再升级!
开发语言·javascript·ecmascript·dhtmlx·图表开发·diagram·javascript图表库
shuaijie05181 小时前
当表格数据量过大的时候,如何使用不分页进行展示
javascript·vue.js·ecmascript
JosieBook2 小时前
【Vue】03 Vue技术——Vue.js 入门学习笔记:Hello World 案例详解
vue.js·笔记·学习