作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我指的是文档 http://v3.iviewui.com/components/tabs-en用于为选项卡分配徽章计数。
我的 HTML:
<Tabs>
<TabPane :label="label">
Some Components here
</TabPane>
<Tabs>
<script>
import { Tabs, TabPane, Badge } from "iview";
export default {
components: {
Tabs,
TabPane,
Badge
},
data() {
return {
label: (h) => {
return h("div", [
h("span", "Result"),
h("Badge", {
props: {
count: 5
}
})
]);
}
};
}
[Vue warn]: Unknown custom element: Badge - did you register the component correctly? For recursive components, make sure to provide the "name" option.
最佳答案
回答你的第一个问题,问题是你引用了"Badge"
在您的渲染函数中,这意味着 Vue 将寻找具有该名称的全局注册组件。你想要的是使用本地注册的组件
h(Badge, {
props: {
count: 5
}
})
am I possible to modify the badge count value from a method within the component ?
data () {
return {
count: 5, // initial value,
label: h => h('div', [
h('span', 'Result'),
h(Badge, {
props: {
count: this.count
}
})
])
}
},
methods: {
incrementCount () {
this.count++
}
}
关于vue.js - vuejs - 使用带有徽章计数的 ivew 选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59244395/
我指的是文档 http://v3.iviewui.com/components/tabs-en用于为选项卡分配徽章计数。 我的 HTML: Some Components here
我是一名优秀的程序员,十分优秀!