我正在尝试在我的应用程序中使用智能应用程序横幅,但是由于没有在网络上为它打字,我不知道如何使用它的角度。
到目前为止,我已经在我的app.component.ts中找到了这个:
import * as smartBanner from "smart-app-banner";
let smartBannerInstance = smartBanner();
constructor() {
new smartBannerInstance({
daysHidden: 10, // days to hide banner after close button is clicked (defaults to 15)
daysReminder: 20, // days to hide banner after "VIEW" button is clicked (defaults to 90)
// appStoreLanguage: 'us', // language code for the App Store (defaults to user's browser language)
title: "Title",
author: "Authot",
button: "VIEW",
store: {
ios: "On the App Store",
android: "In Google Play"
},
price: {
ios: "FREE",
android: "FREE"
}
// force: 'android' // Uncomment for platform emulation
});
}但我得到了平常的
Uncaught TypeError: Cannot set property 'options' of undefined at SmartBanner
我怎么才能把这事做好?
发布于 2018-07-31 10:59:24
因此,将一个简单的JS库实现为一个角度应用程序的过程如下(在这个特定的例子中,也就是说,它将适用于大多数库):
首先,我们使用以下所有选择器导入库:
import * as SmartBanner from "../../node_modules/smart-app-banner/dist/smart-app-banner.js";然后,在我们的AppComponent类中声明它,然后在构造函数中初始化它。
SmartBanner: any;
constructor() {
new SmartBanner({
daysHidden: 10, // days to hide banner after close button is clicked (defaults to 15)
daysReminder: 20, // days to hide banner after "VIEW" button is clicked (defaults to 90)
// appStoreLanguage: 'us', // language code for the App Store (defaults to user's browser language)
title: "Title",
author: "Author",
button: "VIEW",
store: {
ios: "On the App Store",
android: "In Google Play"
},
price: {
ios: "FREE",
android: "FREE"
}
// force: 'android' // Uncomment for platform emulation
});
}而且效果很好。
如果这是一个性能问题,请任何有进一步的知识,让我知道。
https://stackoverflow.com/questions/51608777
复制相似问题