无法读取未定义的 属性 'tz' - Ember 时刻时区
Cannot read property 'tz' of undefined - Ember Moment Timezone
我有一个 ember 应用程序,我正在尝试将时区时刻添加到:
{
"name": "front-end",
"dependencies": {
"handlebars": "~1.3.0",
"jquery": "^1.11.1",
"ember": "1.8.1",
"ember-data": "~1.0.0-beta.14.1",
"ember-resolver": "~0.1.7",
"loader.js": "stefanpenner/loader.js#1.0.1",
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4",
"ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2",
"ember-qunit": "0.1.8",
"ember-qunit-notifications": "0.0.4",
"qunit": "~1.17.1",
"bootstrap": "~3.3.2",
"ember-simple-auth": "0.7.3",
"jquery-autosize": "~1.18.12",
"moment-timezone": "~0.3.0"
}
}
我在 Brocfile.js:
中用这一行加载了 js 文件
app.import('bower_components/moment-timezone/builds/moment-timezone-with-data-2010-2020.min.js');
当我启动 ember 服务器时,甚至在我在任何自定义脚本中调用 moment 之前,我都会收到以下错误:
Uncaught TypeError: Cannot read property 'tz' of undefined
谁能告诉我加载 moment-timezone 的正确方法?
谢谢!
在导入 Moment 时区之前,您需要先导入 Moment。
我有一个 ember 应用程序,我正在尝试将时区时刻添加到:
{
"name": "front-end",
"dependencies": {
"handlebars": "~1.3.0",
"jquery": "^1.11.1",
"ember": "1.8.1",
"ember-data": "~1.0.0-beta.14.1",
"ember-resolver": "~0.1.7",
"loader.js": "stefanpenner/loader.js#1.0.1",
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4",
"ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2",
"ember-qunit": "0.1.8",
"ember-qunit-notifications": "0.0.4",
"qunit": "~1.17.1",
"bootstrap": "~3.3.2",
"ember-simple-auth": "0.7.3",
"jquery-autosize": "~1.18.12",
"moment-timezone": "~0.3.0"
}
}
我在 Brocfile.js:
中用这一行加载了 js 文件app.import('bower_components/moment-timezone/builds/moment-timezone-with-data-2010-2020.min.js');
当我启动 ember 服务器时,甚至在我在任何自定义脚本中调用 moment 之前,我都会收到以下错误:
Uncaught TypeError: Cannot read property 'tz' of undefined
谁能告诉我加载 moment-timezone 的正确方法? 谢谢!
在导入 Moment 时区之前,您需要先导入 Moment。