5 javascript vue.js vue-router vue-component
我正在尝试使以下 Vue 组件正常工作:
<template>
<div>
<cx-button href="/new">
Create
</cx-button>
<router-link tag="cx-button" to="/new" class="cx-raised">Create</router-link>
</div>
</template>
<script>
import cxButton from '../elements/cxButton/cxButton';
export default {
// ...
components: {
cxButton
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
但它抛出:[Vue warn]: Unknown custom element: <cx-button> - did you register the component correctly? For recursive components, make sure to provide the "name" option. found in ---> <RouterLink>.
提供了按钮元素的名称。
cx-button组件本身可以很好地呈现,router-link不使用属性中的cx-button值也是如此tag。问题是:我应该怎么做才能router-link使用自定义元素(例如我的按钮)作为其标签?
| 归档时间: |
|
| 查看次数: |
3627 次 |
| 最近记录: |