-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Error in render: "ReferenceError: "sp" undefined" #8228
Comments
Seems to be a duplicate of #7946. There is already a PR for this: #8048. It should work correctly if you revert to |
再次谢谢你。这个PR我昨天看过了,也试过了,还是不行。我用2.5.15的试了,不行。我遇到这个问题看起来和那个问题差不多,但确实不一样。因为我这里的v-for是在template上,并且里面又v-if和v-else。如果换种方式: |
The repro doesn't even run on IE. After fixing the problems there don't seem to be any issue: const vm = new Vue({
el: '#app',
template: '<div id="app"><select style="width:200px"><template v-for="sp in product.specs"><option v-if="sp.id == product.specId" :value="sp.id" selected>{{sp.name}}</option><option v-else :value="sp.id">{{sp.name}}</option></template></select></div>',
data: {
product: {
specId: 2,
specs: []
}
},
created: function () {
var self = this
setTimeout(function () {
self.product.specs = [
{id: 1, name: 'hello'},
{id: 2, name: 'world'}
];
}, 1e3);
}
}); BTW it looks like you're trying to mimc v-model |
Oh, yeah, forgot to say, you cannot use template inside |
Thank you very much |
Version
2.5.16
Reproduction link
https://codepen.io/windyflying/pen/JvzvRb
Steps to reproduce
1.用Chrome或Firefox或Edge打开重现链接,查看结果,代码按预期工作。
2.用IE11打开重现链接,代码不能按预期运行。检查浏览器控制台,有运行时错误,如标题。
What is expected?
没有运行时错误
What is actually happening?
出现运行时错误
编译后的模板函数在IE11、 IE10和工作正常的浏览器的不一致。
The text was updated successfully, but these errors were encountered: