从 platform.js 升级到 webcomponents.js 问题
Upgrading from platform.js to webcomponents.js issue
我刚刚更新了我的聚合物项目 (bower update) 以切换到新的 webcomponents.js 库。
但是我得到一个:
"Uncaught TypeError: undefined is not a function" 在 polymer.js:12
这是我的 index.html 页面:
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Nautes Dashboard</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild-->
<!-- Place your HTML imports here -->
<script src="bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="elements/elements.html">
</head>
<body>
<nautes-pass-dashboard>
</nautes-pass-dashboard>
<script>
document.addEventListener('polymer-ready', function() {
// Perform some behaviour
});
</script>
</body>
我必须切换回旧的导入才能再次运行:
<script src="bower_components/platform/platform.js"></script>
我是不是在更新我的项目时做错了什么?
如果您还在使用 platform.js
我猜您使用的是旧版本的 Polymer。
我的猜测是,当您更新到 webcomponents.js
时,您保留了旧版本的 Polymer,它与 webcomponents.js
.
不兼容
如果我的猜测是正确的,您需要更新所有 Polymer 设置,而不仅仅是将 platform.js
更改为 webcomponents.js
。使用 Polymer 的 0.5.5 版本,它应该可以更好地工作。
我刚刚更新了我的聚合物项目 (bower update) 以切换到新的 webcomponents.js 库。 但是我得到一个: "Uncaught TypeError: undefined is not a function" 在 polymer.js:12
这是我的 index.html 页面:
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Nautes Dashboard</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild-->
<!-- Place your HTML imports here -->
<script src="bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="elements/elements.html">
</head>
<body>
<nautes-pass-dashboard>
</nautes-pass-dashboard>
<script>
document.addEventListener('polymer-ready', function() {
// Perform some behaviour
});
</script>
</body>
我必须切换回旧的导入才能再次运行:
<script src="bower_components/platform/platform.js"></script>
我是不是在更新我的项目时做错了什么?
如果您还在使用 platform.js
我猜您使用的是旧版本的 Polymer。
我的猜测是,当您更新到 webcomponents.js
时,您保留了旧版本的 Polymer,它与 webcomponents.js
.
如果我的猜测是正确的,您需要更新所有 Polymer 设置,而不仅仅是将 platform.js
更改为 webcomponents.js
。使用 Polymer 的 0.5.5 版本,它应该可以更好地工作。