我不是专业人士,请在下面提供一种简单的方法或好的资源来实施代码。它是又大又长的组件,将放入npm包中,并且需要html标记才能在应用程序内部安装。如何实现此代码? 谢谢。 已经阅读了一些文章,并在有用的情况下开放阅读更多内容。
// child component
<template functional>
</template>
// parent component == must be reuse able, standalone, and will be a npm package
// will install as plugin in some consumer apps.
<script>
export default {
name : ...
?template: `
<div>
if it possible child comp can come here as template
</div>
`
components: {}
props: {}
data: {}
beforeMount: {}
computed: {}
method: {}
watch: {}
render() {
// already tried JSX but 2 attrs lost their functionality
// can use createElement(), h() or what ever you suggest
// but there are many html tags it's really pain to use that long way.
// need short pattern here like h('div', childComponent).
}
}
</script>
<style lang="scss">
scss guys come here (long)
</style>