Closed Intrflex closed 2 years ago
Further testing actually shows its not the data-class.. its the fact i have function inside the class
This is a bug.
Thanks for your feedback.
It is caused by use .split('function')
for split render function as string:
https://github.com/JuniorTour/vue-template-babel-compiler/blob/cb23dc9c4df0a8b974129f9faece15550024477f/src/templateCompiler.js#L25
So the staticRenderFns
:
var staticRenderFns = [function () {
var _vm=this;
var _h=_vm.$createElement;
var _c=_vm._self._c||_h;
return _c('div', {
attrs: {
"id": "app"
}
}, [_c('a', {
attrs: {
"attr": "function"
}
}, [_vm._v("1")])]);
}];
will be split wrongly by getArrayItems(compiledStaticRenders)
into:
Maybe we can use a more accurate Regular expression to parse render function?
We can add /* staticRenderSeperator */
during staticRenders.map()
, and split functions more accurate:
https://github.com/JuniorTour/vue-template-babel-compiler/blob/cb23dc9c4df0a8b974129f9faece15550024477f/src/templateCompiler.js#L42
There is also a CONTRIBUTING.md you can follow.
@Intrflex We have fixed this issue!
You can try it by run:
npm install vue-template-babel-compiler@latest
Thanks for your feedback again!
Minor bug When and div has a data attribute like data-class the compiler can not compile and reports unexpected token :(
<li> <a class="btn js-waves-off" data-action="toggle" data-class="nav-function-fixed" href="#" title="Lock Navigation"> <i class="ni ni-lock-nav" /> </a> </li>