简体   繁体   English

如何在VueJS中将组件呈现为数据属性

[英]How can I render component as data attribute in VueJS

For example I have a template and some other <my-component> : 例如,我有一个模板和其他一些<my-component>

template: '<i data-toggle="popover" data-html="true" data-content="**Here I need render another  component in loop**"></i>'

This 这个

 :data-content="<my-component v-for... ></my-component>"

doesn't work. 不起作用。 Perhaps there is a method to render my-component in another place ? 也许有一种方法可以在另一个地方渲染my-component? In computed area... or in methods ? 在计算区域中...还是在方法中?

So, how can I render component in html data-*attributes ? 因此,如何在html data- * attributes中呈现组件?

Thank you. 谢谢。

You will have to convert your component to be functional. 您将不得不转换您的组件才能正常工作。 Read Introduction to Vue.js Render Functions and Render Functional Components in Vue.js 阅读Vue.js渲染功能Vue.js中的渲染功能组件简介

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM