如何不使用组件去复用一段html模板呢? #8005
Unanswered
CBCBA
asked this question in
Help/Questions
Replies: 4 comments 6 replies
-
建议还是使用组件,这样虽然可以实现,但是写起来总感觉有点别扭。 |
Beta Was this translation helpful? Give feedback.
6 replies
-
复用我知道,其他就不大懂了😄 <script setup lang="tsx">
const temp = () => <div>哈哈</div>
</script>
<template>
<temp />
<component :is="temp"></component>
</template> |
Beta Was this translation helpful? Give feedback.
0 replies
-
use https://vue-macros.sxzz.moe/features/named-template.html |
Beta Was this translation helpful? Give feedback.
0 replies
-
@CBCBA 刚好看到一个新的api就想到你这个场景了,你可以看看 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
php模板引擎有下面的include用法:
当一个文件被包含时,其中所包含的代码继承了 include 所在行的变量范围。如果 include出现于调用文件中的一个函数里,则被调用的文件中所包含的所有代码将表现得如同它们是在该函数内部定义的一样。
vue有类似引入一段模板字符串的功能,其内部变量的作用域是属于当前页面的功能吗,不需要封装复杂的组件
Beta Was this translation helpful? Give feedback.
All reactions