-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vue.config.js
vueLoader.preserveWhitespace = false not work
#962
Comments
Tested, and it's working with or without |
@jkzing |
@yozman Yes, from what I'm seeing, |
@jkzing // parent.js
import Child from './child';
const template = /*html*/`
<child>
<h1>one</h1>
<h1>two</h1>
</child>
`;
export default {
template,
components: {
Child,
},
};
// child.js
const template = /*html*/`
<div>
<slot/>
</div>
`;
export default {
template,
created() {
console.log(this.$slots.default.length);
},
}; |
Well, if you use js files, then you are not using vue-loader, which only takes care of |
Inline JS strings are compiled by the runtime compiler, not |
@yyx990803 @LinusBorg // ...
export default {
render: () => Vue.compile(template, {
preserveWhitespace: false,
}),
}; maybe there should be a way to set |
@yyx990803 @LinusBorg |
This would have to be addressed in the vue repository, not here. Toy should open a feature request over there and explain the use case. |
@yozman you cannot. If you want that behavior you have to use pre-compile via |
@yyx990803 why don't u make a feature to that, as every FE known everything is js, not |
yes, inline template need preserve whitespace between tags. @yyx990803 |
Version
3.0.0-beta.6
Reproduction link
https://jsfiddle.net/yozman/3Lcwjrts/
Steps to reproduce
vue.config.js
What is expected?
$slots.default 去掉空格
What is actually happening?
$slots.default 空格一直存在
感觉是 vueLoader 的 preserveWhitespace 未生效
The text was updated successfully, but these errors were encountered: