CompileTemplate generates a difference in the render function #8746
Replies: 2 comments
-
我也遇到一模一样的问题 // I had the same problem. |
Beta Was this translation helpful? Give feedback.
-
在 @ShenQingchuan 的帮助下,解决了编译绑定变量的问题。比如下图: 使用 code as below: const scripted= compiler.compileScript(......)
const templated= compiler.compileTemplate( { ...., compileOptions:{ inline:false, bindingMetadata: scripted.bindings } }
// _________________________________________________________________________________________________________^^^^^^^^^^^^ 通过 |
Beta Was this translation helpful? Give feedback.
-
I tried compiling
.vue
files myself usingcompiler-sfc
, I did succeed, but only for regular<script>
tags, when I use<script setup>
, the compiledrender
The function keeps reporting an error. I think it may be a problem with my parameter settings. The following two pieces of code are the results compiled by myself and compiled using Vite. It can be found that the parameters of therender
function are different. Why is this so? , how should I set the parameters to be the same as the content compiled by Vite.↓ This is the Counter.vue :
↓ This is Vite compiled result, it has the
$setup
option, and it use$setup.count
, it can run :↓ This is my compiled result, it use
_ctx.count
, has browser error :_ctx.count is undefined
:↓ This is the file I use to compile in NodeJS, my parameter settings are like this :
I have been troubled by this problem for two days. I tried to find a way to solve it myself, but there is not much content related to the compiler. I have searched for a long time for the information but could not solve it. I have begun to despair. I really hope that someone can help me , thank you so much. 😭😭😭
Beta Was this translation helpful? Give feedback.
All reactions