Ionic Framework 是否消除了在没有任何框架的情况下启动的可能性?
>ionic start MyAPP blank
Pick a framework!
Please select the JavaScript framework to use for your new app. To bypass this prompt next time, supply a value for the
--type option.
? Framework: (Use arrow keys)
> Angular | https://angular.io
React | https://reactjs.org
Vue | https://vuejs.org
即使在文档中,如果没有其中之一,也无法遵循:
遇到这种情况该怎么办?
是的,可以在没有 Angular 或 Vue 的情况下创建 ionic 项目,也可以手动做出反应。
以下是index.html文件:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ionic Project</title>
<link href="https://cdn.jsdelivr.net/npm/@ionic/core/css/ionic.bundle.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.js"></script>
<style>
.bg-light {
--background: lightskyblue;
}
</style>
</head>
<body>
<ion-app>
<ion-header>
<ion-toolbar class="bg-light">
<ion-title>Ionic Project</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-button id="my-button">Click Me</ion-button>
</ion-content>
</ion-app>
<script src="main.js"></script>
</body>
</html>
下面是main.js flie
document.addEventListener('DOMContentLoaded', () => {
const button = document.getElementById('my-button');
button.addEventListener('click', () => {
alert('Button clicked!');
});
});