mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 10:41:13 +08:00
feat(vue): add ionic vue beta (#22062)
This commit is contained in:
26
packages/vue/src/components/IonBackButton.ts
Normal file
26
packages/vue/src/components/IonBackButton.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { h, inject, defineComponent } from 'vue';
|
||||
|
||||
export const IonBackButton = defineComponent({
|
||||
name: 'IonBackButton',
|
||||
setup(_, { attrs, slots }) {
|
||||
const ionRouter: any = inject('navManager');
|
||||
|
||||
const onClick = () => {
|
||||
const defaultHref = attrs['default-href'] || attrs['defaultHref'];
|
||||
const routerAnimation = attrs['router-animation'] || attrs['routerAnimation'];
|
||||
|
||||
ionRouter.handleNavigateBack(defaultHref, routerAnimation);
|
||||
}
|
||||
|
||||
return () => {
|
||||
return h(
|
||||
'ion-back-button',
|
||||
{
|
||||
onClick,
|
||||
...attrs
|
||||
},
|
||||
slots.default && slots.default()
|
||||
)
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user