【问题标题】:Invalid expression passing props in vue.js template - IE11vue.js 模板中的无效表达式传递道具 - IE11
【发布时间】:2018-01-23 16:12:23
【问题描述】:

我是 vue.js 的新手,我正在尝试创建一个 Vue 组件。

Vue.component('sales-report', {
  data: function() { 
    return { products: products, seasons: seasons }
  },
  template: '<course-details-menu :dropdown-data="{ products, outlineClassifications, seasons, years }"></course-details-menu>'
});

这是我的应用程序的简化示例,它可以在 Chrome 中运行,但在 IE 中,我从 Vue 收到此错误:

编译模板时出错:: - 无效表达式::dropdown-data="{ products, seasons }" 发现在--->&lt;SalesReport&gt;

【问题讨论】:

    标签: javascript internet-explorer vue.js


    【解决方案1】:

    IE11 doesn't support ECMAScript 2015 属性名称简写。

    您需要像这样显式声明对象的键值:

    :dropdown-data="{ products: products, seasons: seasons }"
    

    【讨论】:

    • 啊——呃。谢谢!花了太多时间调试这个!
    猜你喜欢
    • 1970-01-01
    • 2019-10-29
    • 2023-04-03
    • 2020-01-17
    • 2018-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多