-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(runtime): create Tabs component and improve demo app (WIP)
- Loading branch information
Showing
4 changed files
with
55 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,41 @@ | ||
import PageComp from '~/PageComp' | ||
import { ref } from 'nativescript-vue' | ||
import { Tabs } from 'nativescript-vue' | ||
|
||
export default { | ||
template: `<Tabs selectedIndex="1"> | ||
<TabStrip> | ||
<TabStripItem> | ||
<Label text="Home"></Label> | ||
</TabStripItem> | ||
<TabStripItem> | ||
<Label text="Account"></Label> | ||
</TabStripItem> | ||
<TabStripItem> | ||
<Label text="Search"></Label> | ||
</TabStripItem> | ||
</TabStrip> | ||
<TabContentItem> | ||
<GridLayout> | ||
<Label text="Home Page"></Label> | ||
</GridLayout> | ||
</TabContentItem> | ||
<TabContentItem> | ||
<GridLayout> | ||
<Label text="Account Page"></Label> | ||
</GridLayout> | ||
</TabContentItem> | ||
<TabContentItem> | ||
<GridLayout> | ||
<Label text="Search Page"></Label> | ||
</GridLayout> | ||
</TabContentItem> | ||
</Tabs>`, | ||
data() { | ||
return {} | ||
components: { | ||
Tabs, | ||
}, | ||
watch: { | ||
model(value) {}, | ||
template: ` | ||
<StackLayout> | ||
<Label :text="activeTab" /> | ||
<Button text="Add tab" @tap="tabs.push({title: 'new', text: 'new tab'})" /> | ||
<Button text="Go last" @tap="activeTab = tabs.length - 1" /> | ||
<Tabs v-model="activeTab"> | ||
<TabStrip> | ||
<TabStripItem | ||
v-for="(tab, i) in tabs" | ||
:key="i + tab.title" | ||
:title="tab.title"> | ||
</TabStripItem> | ||
</TabStrip> | ||
<TabContentItem | ||
v-for="(tab, i) in tabs" | ||
:key="i + tab.title"> | ||
<GridLayout> | ||
<Label :text="tab.text" /> | ||
</GridLayout> | ||
</TabContentItem> | ||
</Tabs> | ||
</StackLayout>`, | ||
data() { | ||
return { | ||
activeTab: 1, | ||
tabs: [ | ||
{ title: 'First Tab', text: 'im the first tab' }, | ||
{ title: 'Second Tab', text: 'im the second tab' }, | ||
{ title: 'Third Tab', text: 'im the third tab' }, | ||
], | ||
} | ||
}, | ||
mounted() {}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { FunctionalComponent, h } from '@vue/runtime-core' | ||
import { NSVElement } from '../nodes' | ||
|
||
export const Tabs: FunctionalComponent = (props, ctx) => { | ||
return h( | ||
'InternalTabs', | ||
{ | ||
...ctx.attrs, | ||
onVnodeMounted(vnode) { | ||
const el = vnode.el as NSVElement | ||
console.log(el) | ||
// TODO: Implement | ||
}, | ||
}, | ||
ctx.slots.default ? ctx.slots.default() : undefined | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters