Can’t get component to load in tab using Stencil and Ionic (router, tabs). The code below is based on the Stencil Conference App.
Currently, I am able to switch between the tabs, but the button component does not load in tab-one.
When I paste the button html in the ion-tab element, it loads, but is not interactive (apparently behind the tabs).
After a week of exploring this topic, I’m not sure how to proceed. Thanks.
`<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>CodePen - ionic-tab example</title>
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.esm.js"></script>
<script type="module"="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.js"></script>
<script type="module"="https://cdn.jsdelivr.net/npm/@stencil/core@2.15.1/internal/stencil-core/index.cjs" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core/css/ionic.bundle.css" />
</head>
<body>
<!-- partial:index.partial.html -->
<ion-app>
<ion-tabs>
<!-- Tab views -->
<ion-tab tab="tab-one" component="one-component">one
<ion-nav></ion-nav>
</ion-tab>
<ion-tab tab="two" component="two-component"> two </ion-tab>
<ion-tab tab="three" component="three-component"> three </ion-tab>
<!-- Tab bar -->
<ion-tab-bar slot="bottom">
<ion-tab-button tab="tab-one">
<ion-icon name="camera"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="two">
<ion-icon name="headset"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="three">
<ion-icon name="magnet"></ion-icon>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
<ion-router useHash={false}>
<ion-route url="/" component="tab-one">
<ion-route component="page-one"></ion-route>
</ion-route>
<ion-route url="/two-page" component="two"></ion-route>
<ion-route url="/three-page" component="three"></ion-route>
</ion-router>
</ion-app>
<script type="module">
import {
Config,
alertController,
getMode,
loadingController,
modalController,
toastController
} from "@ionic/core";
import {
Component,
Element,
forceUpdate,
Listen,
Prop,
State,
h
} from "@stencil/core";
@Component({
tag: "page-one"
})
export class PageOne {
@Element() el: any;
render() {
return [ < ion - content >
<
ion - button shape = "round" > Round Button < /ion-button>, <
/ion - content >
];
}
}
</script>
<!-- partial -->
// <script type="module" src="./script.js"></script>
</body>
</html>
`


