vuejs2 - [Vue 警告]:未知的自定义元素:- 您是否正确注册了组件?vue-社交分享
问题描述
尝试使用 vue-social-sharing(最新版本 2.4.3)库,但不断得到以下信息:
[Vue 警告]:未知的自定义元素:- 您是否正确注册了组件?对于递归组件,请确保提供“名称”选项。
我按照指南查看了代码示例。但是,似乎无法弄清楚我错过了什么或出错了。
我创建了一个单独的组件,并按照 vue-social-share 提供的示例进行操作。但仍然不断收到错误。
这是我的 main.js:
import Vue from 'vue'
import './plugins/vuetify'
import App from './App.vue'
import router from './router'
import store from './store'
Vue.config.productionTip = false;
let SocialSharing = require('vue-social-sharing');
Vue.use(SocialSharing);
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app');
这是我的组件(SocialSharingTest.vue):
<template>
<social-sharing url="https://vuejs.org/"
title="The Progressive JavaScript Framework"
description="Intuitive, Fast and Composable MVVM for building interactive interfaces."
quote="Vue is a progressive framework for building user interfaces."
hashtags="vuejs,javascript,framework"
twitter-user="vuejs"
inline-template>
<div>
<network network="email">
<i class="fa fa-envelope"></i> Email
</network>
<network network="facebook">
<v-icon class="mr-3" style="color: #3b5998">fab fa-facebook</v-icon>
</network>
<network network="googleplus">
<i class="fa fa-google-plus"></i> Google +
</network>
</div>
</social-sharing>
</template>
<script>
export default {
name: "SocialSharingTest",
}
</script>
<style scoped>
</style>
组件未按预期工作,并如上所述不断收到 **[Vue 警告]。我在这里看到了一个我希望看到的工作示例:
解决方案
import SocialSharing from 'vue-social-sharing';
import Vue from 'vue'
const VueSelect = {
install(Vue, options) {
Vue.component('SocialSharing', SocialSharing)
}
};
Vue.use(VueSelect)
你可以试试这个,看看它是否有效?
推荐阅读
- javascript - 如何将这个 Shader 函数翻译成 JS?
- python - 将字符串变量或字符串数组从 python 传递到 curl 脚本
- terraform - Terraform 中的 Prometheus 配置和部署
- google-bigquery - 如何修复 BigQuery 中对更新计划查询的临时中断访问?
- javascript - 使用 google book api (vanilla js) 获取缩略图的问题
- python - Tensorbaord中每个时间步长的线图?
- java - Setter 没有按照应有的方式在 SpringBoot 项目中保存变量
- macos - 在 MacOS/Metal(英特尔 CPU、离散和内部 GPU)上渲染时,帧率会经常下降
- python - 图像处理中的多线程 - 视频 python opencv
- python - 从 numpy ndarray 索引多个最小值