ember.js 错误:Assert失败:必须为链接到组件提供一个或多个参数

m0rkklqb  于 2022-11-05  发布在  其他
关注(0)|答案(1)|浏览(135)

我正在跟踪emberjs tutorial,在添加<LinkTo>标记时遇到错误。我不确定它的含义,因为我找不到任何文档来正确构造此标记。
我需要做些什么来正确地构造它呢?它不会在页面上呈现。
以下是我的环境:
ember-气候:3.6.1
节点:13.12.0
操作系统:达尔文x64
下面是控制台中的错误:

Error: Assertion Failed: You must provide one or more parameters to the link-to component.

下面是相关的代码片段
应用程序/模板/索引.hbs

<div class="jumbo">
  <div class="right tomster"></div>
  <h2>Welcome to Super Rentals!</h2>
  <p>We hope you find exactly what you're looking for in a place to stay.</p>
  <LinkTo @route="about">About</LinkTo>
</div>

app/router.js

import EmberRouter from '@ember/routing/router';
import config from './config/environment';

export default class Router extends EmberRouter {
  location = config.locationType;
  rootURL = config.rootURL;
}

Router.map(function() {
  this.route('about');
});
e4eetjau

e4eetjau1#

您的调用语法是正确的。但是,您正在参考最新版本的Ember指南,而您已经安装了Ember 3.6版。您可以将您的ember版本升级到最新版本,或者如果您想坚持使用3.6版,则可以使用here goes the guide for 3.6。
实际的错误是由于Built-In组件的真正尖括号组件调用样式仅为landed on Ember version 3.10.。因此,您的Ember版本必须为=〉3.10才能工作。
下面是一个twiddle,它演示了LinkTo组件在Ember 3.17版本中的用法

相关问题