我正在尝试使用布局视图。我使用布局视图的模块称为仪表板。我在布局视图中有这个片段:
<div class="manage-btn" click.delegate="manageClick()">MANAGE ACCOUNT</div>
这是我的dashboard.html:
<template>
<router-view layout-view="src/layouts/dash-layout.html"></router-view>
</template>
然后在我的dashboard.js中我有这个功能:
manageClick() {
if (this.profileDropClass === '') {
this.profileDropClass = 'show';
}
else {
this.profileDropClass = '';
}
}// manageClick()
我一直收到一条错误消息,指出manageClick()不是函数。我有功能,我想要在布局视图中,这是不可能的?如果我必须重复这个功能,那么布局视图有什么用呢?
答案 0 :(得分:0)
您必须定义layout-viewmodel和/或model。请查看以下博文,了解更多详情https://www.google.at/amp/s/charlespockert.wordpress.com/2016/07/05/using-the-layouts-feature-in-aurelia/amp/