AngularJS プロジェクトでSmart App Bannerを使用したいのですが、それ自体を管理するためにsmart-app-banner
使用します。npm
このガイドは非常にシンプルで、すべてが 1 つの html ファイルにまとめられています。ただし、実際のプロジェクトでは、各ファイルを適切な場所に配置する必要があります。
- CSS (私のプロジェクトは を使用
scss
)
では、 html ファイルsample
に次の 1 行があります。head
<link rel="stylesheet" href="node_modules/smart-app-banner/smart-app-banner.css" type="text/css" media="screen">
したがって、私のプロジェクトでは、この css ファイルを次の場所にインポートしますapp.scss
。
@import "node_modules/smart-app-banner/smart-app-banner";
- JS (私のプロジェクトは を使用
ECMAScript 6
)
では、 html ファイルsample
に JS の 2 つの部分があります。body
最初の部分:
<script src="node_modules/smart-app-banner/smart-app-banner.js"></script>
したがって、私のプロジェクトでは、この js ファイルを次の場所にインポートしますapp.js
。
import "smart-app-banner";
第二部:
<script type="text/javascript">
new SmartBanner({
daysHidden: 15, // days to hide banner after close button is clicked (defaults to 15)
daysReminder: 90, // 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: 'MyPage',
author: 'MyCompany LLC',
button: 'VIEW',
store: {
ios: 'On the App Store',
android: 'In Google Play',
windows: 'In Windows store'
},
price: {
ios: 'FREE',
android: 'FREE',
windows: 'FREE'
}
// , force: 'ios' // Uncomment for platform emulation
});
</script>
私のプロジェクトでは、ファイルとsmart-banner.js
同じディレクトリに呼び出される新しいjsファイルを作成しapp.js
、このコードを入れてから、jsファイルをインポートしますapp.js
import "./smart-banner";
smart-banner.js:
new SmartBanner({
daysHidden: 15, // days to hide banner after close button is clicked (defaults to 15)
daysReminder: 90, // 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: 'MyPage',
author: 'MyCompany LLC',
button: 'VIEW',
store: {
ios: 'On the App Store',
android: 'In Google Play',
windows: 'In Windows store'
},
price: {
ios: 'FREE',
android: 'FREE',
windows: 'FREE'
}
// , force: 'ios' // Uncomment for platform emulation
});
しかし、それは機能していません。バナーが正しく表示されませんでした。ステップが間違っていませんか?これらのプロセスを段階的にチェックして、すべてのファイルが正しく機能することを確認するにはどうすればよいですか?