You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried compiling .vue files myself using compiler-sfc, I did succeed, but only for regular <script> tags, when I use <script setup>, the compiled render 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 vue3-sfc-loader. It can be found that the parameters of the render function are different. Why is this so? , how should I set the parameters to be the same as the content compiled by vue3-sfc-loader.
↓ This is vue3-sfc-loader compiled result, it has the $setup option, and it use $setup.count, it can run :
exportfunctionrender(_ctx,_cache,$props,$setup,$data,$options){return(_openBlock(),_createElementBlock("button",{type: "button",onClick: _cache[0]||(_cache[0]=$event=>($setup.count++))},_toDisplayString($setup.count),1/* TEXT */))}
↓ This is my compiled result, it use _ctx.count, has browser error : _ctx.count is undefined :
exportfunctionrender(_ctx,_cache){return(_openBlock(),_createElementBlock("button",{type: "button",onClick: _cache[0]||(_cache[0]=$event=>(_ctx.count++))},_toDisplayString(_ctx.count),1/* TEXT */))}
↓ This is the file I use to compile in NodeJS, my parameter settings are like this :
I know that this problem is not directly related to vue3-sfc-loader, but I found that vue3-sfc-loader can solve this problem, so I try to ask questions here. 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. 😭😭😭
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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 vue3-sfc-loader. 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 vue3-sfc-loader.↓ This is the Counter.vue :
↓ This is vue3-sfc-loader 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 know that this problem is not directly related to vue3-sfc-loader, but I found that vue3-sfc-loader can solve this problem, so I try to ask questions here. 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