作者:棒棒冰 | 来源:互联网 | 2023-01-14 12:36
weather.ts文件import{bindable}from'aurelia-framework';exportclassWeather{cityName:
weather.ts文件
import {bindable} from 'aurelia-framework';
export class Weather {
cityName: string = 'Hilsinki';
constructor() {
this.cityName = 'Hilsinki';
}
}
weather.html文件
City XName: ${cityName}
当我在任何文件中打印组件时,不会打印cityName变量.我每天12小时都在尝试这3天.
任何形式的帮助表示赞赏
更新:
利用welcome.html中的组件
还将welcome.ts中的组件导入为
import { Weather } from './components/weather';
解决方法:
您不需要viewmodel,只需要视图.
如果您同时需要视图和视图模型,请改为: