Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork245
Closed
Milestone
Description
In samplesamples/app/app-with-tab-view.js
<tab-view :selectedIndex="selectedTab">
But in fileplatform/nativescript/runtime/components/tab-view.js
has propselectedTab
export default { name: 'tab-view', props: ['selectedTab'],
I try to change two-way binding but it's not work
export default { name: 'tab-view', model: { prop: 'selectedTab', event: 'selectedTabChanged', }, props: ['selectedTab'], template: `<native-tab-view ref="tabView" v-model="selectedIndex"><slot></slot></native-tab-view>`, data() { return { selectedIndex: 0 } }, watch: { selectedTab(index) { this.selectedIndex = index }, selectedIndex(index) { this.$emit('selectedTabChanged', index) }, }, methods: { registerTab(tabView) { let items = this.$refs.tabView.nativeView.items || [] this.$refs.tabView.setAttribute('items', items.concat([tabView])) } }}
NOT WORK
<tab-view v-model="curTabIndex"></tab-view>
WORK
<tab-view :selectedTab="curTabIndex" @selectedTabChanged="idx => curTabIndex = idx"></tab-view>