Element-ui is used in the project. For example, I want to dynamically generate N components.
<template>
<p class="search" ref="search" v-html="sHtml">
</p>
</template>
<script type="text/javascript">
export default {
data() {
return {
sHtml: '',
}
},
props: {
con: {
type: Array
}
},
created() {
this.con.map((v, i) => {
this.sHtml += '<el-'+ v.type +' class="'+ v.style +'" placeholder="'+ v.placeholder +'" v-model="'+ v.name +'"></el-' + v.type +'>';
});
},
}
</script>
Is there any way to make the element plug-in render on the page?
Can’t v-for directly where the component is referenced? .
Can’t you be more direct, like
Compiling html is not supported now, but it will be possible in 1.0
Use v-for directly to render components through data [array]
You can refer to: https://cn.vuejs.org/v2/guide...Dynamic components