我遵循了本教程的实例: https://www.thepolyglotdeveloper.com/2016/02/add-barcode-scanning-functionality-to-your-ionic-2-app/ 但是,启动应用程序,我收到错误消息:
打字稿错误 '模块'路径/ node_modules / ionic-angular / index“' 没有导出的成员'Page'。
我的代码是:
import {Page, Platform, Alert, NavController} from 'ionic-angular';
@Page({
templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
static get parameters() {
return [[Platform], [NavController]];
}
constructor(platform, navController) {
this.platform = platform;
this.navController = navController;
}
scan() {
this.platform.ready().then(() => {
cordova.plugins.barcodeScanner.scan((result) => {
this.nav.present(Alert.create({
title: "Scan Results",
subTitle: result.text,
buttons: ["Close"]
}));
}, (error) => {
this.nav.present(Alert.create({
title: "Attention!",
subTitle: error,
buttons: ["Close"]
}));
});
});
}
}
我绝对不知道该怎么做。我也是Ionic的新手,因此我不知道该怎么办。
答案 0 :(得分:0)
使用@Component
代替@Page
。
@Page现已弃用
结帐https://forum.ionicframework.com/t/difference-between-page-and-component/55287