// 最外层多个标签,无法在使用子组件标签上定义 class
// 会报错:[Vue warn]: Extraneous non-props attributes (class)
// were passed to component but could not be automatically inherited
// because component renders fragment or text root nodes.
// at <Demo3 class="green" > at <App>
// 下面把这个问题解决了:绑定父标签的属性值
app.component('demo3', {
template: `
<div :class="$attrs.class">zibo31</div>
<div :class="$attrs.class">zibo32</div>
`
});
[Vue warn]: Extraneous non-props attributes (class)
最新推荐文章于 2024-05-24 18:26:39 发布