mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
docs(stencil): add stencil usage to components (#21261)
This commit is contained in:
@ -77,6 +77,47 @@ const ContentExample: React.FC = () => (
|
||||
```
|
||||
|
||||
|
||||
### Stencil
|
||||
|
||||
```tsx
|
||||
import { Component, h } from '@stencil/core';
|
||||
|
||||
@Component({
|
||||
tag: 'content-example',
|
||||
styleUrl: 'content-example.css'
|
||||
})
|
||||
export class ContentExample {
|
||||
logScrollStart() {
|
||||
console.log('Scroll start');
|
||||
}
|
||||
|
||||
logScrolling(ev) {
|
||||
console.log('Scrolling', ev);
|
||||
}
|
||||
|
||||
logScrollEnd() {
|
||||
console.log('Scroll end');
|
||||
}
|
||||
|
||||
render() {
|
||||
return [
|
||||
<ion-content
|
||||
scrollEvents={true}
|
||||
onIonScrollStart={() => this.logScrollStart()}
|
||||
onIonScroll={(ev) => this.logScrolling(ev)}
|
||||
onIonScrollEnd={() => this.logScrollEnd()}>
|
||||
<h1>Main Content</h1>
|
||||
|
||||
<div slot="fixed">
|
||||
<h1>Fixed Content</h1>
|
||||
</div>
|
||||
</ion-content>
|
||||
];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Vue
|
||||
|
||||
```html
|
||||
|
37
core/src/components/content/usage/stencil.md
Normal file
37
core/src/components/content/usage/stencil.md
Normal file
@ -0,0 +1,37 @@
|
||||
```tsx
|
||||
import { Component, h } from '@stencil/core';
|
||||
|
||||
@Component({
|
||||
tag: 'content-example',
|
||||
styleUrl: 'content-example.css'
|
||||
})
|
||||
export class ContentExample {
|
||||
logScrollStart() {
|
||||
console.log('Scroll start');
|
||||
}
|
||||
|
||||
logScrolling(ev) {
|
||||
console.log('Scrolling', ev);
|
||||
}
|
||||
|
||||
logScrollEnd() {
|
||||
console.log('Scroll end');
|
||||
}
|
||||
|
||||
render() {
|
||||
return [
|
||||
<ion-content
|
||||
scrollEvents={true}
|
||||
onIonScrollStart={() => this.logScrollStart()}
|
||||
onIonScroll={(ev) => this.logScrolling(ev)}
|
||||
onIonScrollEnd={() => this.logScrollEnd()}>
|
||||
<h1>Main Content</h1>
|
||||
|
||||
<div slot="fixed">
|
||||
<h1>Fixed Content</h1>
|
||||
</div>
|
||||
</ion-content>
|
||||
];
|
||||
}
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user