|
| 1 | +import Vue from 'nativescript-vue' |
| 2 | + |
| 3 | +Vue.config.debug = true |
| 4 | +Vue.config.silent = false |
| 5 | + |
| 6 | +const Step2 = { |
| 7 | + template: ` |
| 8 | + <Page> |
| 9 | + <ActionBar title="Step 2" /> |
| 10 | +
|
| 11 | + <GridLayout rows="*, auto, auto"> |
| 12 | + <Label text="This is the second step of the wizard." row="0" /> |
| 13 | +
|
| 14 | + <Button text="Previous" @tap="prevStep" row="1" /> |
| 15 | + </GridLayout> |
| 16 | + </Page> |
| 17 | + `, |
| 18 | + methods: { |
| 19 | + prevStep() { |
| 20 | + this.$navigateBack({ |
| 21 | + frame: 'wizard' |
| 22 | + }) |
| 23 | + } |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +const WizardModal = { |
| 28 | + template: ` |
| 29 | + <Frame id="wizard"> |
| 30 | + <Page> |
| 31 | + <ActionBar title="Step 1" /> |
| 32 | + <GridLayout rows="*, auto"> |
| 33 | + <Label text="This is the first step of the wizard." row="0" /> |
| 34 | + <Button text="Next" @tap="nextStep" row="1" /> |
| 35 | + </GridLayout> |
| 36 | + </Page> |
| 37 | + </Frame> |
| 38 | + `, |
| 39 | + methods: { |
| 40 | + nextStep() { |
| 41 | + this.$navigateTo(Step2, { |
| 42 | + frame: 'wizard' |
| 43 | + }) |
| 44 | + } |
| 45 | + } |
| 46 | +} |
| 47 | + |
| 48 | +const TabContent = { |
| 49 | + template: ` |
| 50 | + <GridLayout rows="auto, auto"> |
| 51 | + <Label text="This is the home page." row="0" /> |
| 52 | + <Button text="Open Wizard" row="1" @tap="openWizard" /> |
| 53 | + </GridLayout> |
| 54 | + `, |
| 55 | + methods: { |
| 56 | + openWizard() { |
| 57 | + // show the wizard in a modal, and make sure it is fullscreen. |
| 58 | + this.$showModal(WizardModal, { |
| 59 | + fullscreen: true |
| 60 | + }).then(res => { |
| 61 | + console.log('wizard completed with res', res) |
| 62 | + }) |
| 63 | + } |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +new Vue({ |
| 68 | + components: { |
| 69 | + TabContent |
| 70 | + }, |
| 71 | + template: ` |
| 72 | + <GridLayout rows="*"> |
| 73 | + <TabView androidTabsPosition="bottom" iosIconRenderingMode="alwaysOriginal"> |
| 74 | + <TabViewItem title="Tab1" textTransform="capitalize"> |
| 75 | + <Frame id="main-frame"> |
| 76 | + <Page class="page"> |
| 77 | + <ActionBar title="#536" /> |
| 78 | + <TabContent /> |
| 79 | + </Page> |
| 80 | + </Frame> |
| 81 | + </TabViewItem> |
| 82 | + </TabView> |
| 83 | + </GridLayout> |
| 84 | + ` |
| 85 | +}).$start() |
| 86 | + |
| 87 | +// Working code. Please comment the previous Vue instance and |
| 88 | +// uncomment the next one in order to workaround the issue |
| 89 | +// The workaround is not using a new Vue component as the |
| 90 | +// Tab content, so the wizard is opened using the root component |
| 91 | +/* |
| 92 | +new Vue({ |
| 93 | + components: { |
| 94 | + TabContent, |
| 95 | + }, |
| 96 | + template: ` |
| 97 | + <GridLayout rows="*"> |
| 98 | + <TabView androidTabsPosition="bottom" iosIconRenderingMode="alwaysOriginal"> |
| 99 | + <TabViewItem title="Tab1" textTransform="capitalize"> |
| 100 | + <Frame id="main-frame"> |
| 101 | + <Page class="page"> |
| 102 | + <ActionBar title="#536 - workaround" /> |
| 103 | + <GridLayout rows="auto, auto"> |
| 104 | + <Label text="This is the home page." row="0" /> |
| 105 | + <Button text="Open Wizard" row="1" @tap="openWizard" /> |
| 106 | + </GridLayout> |
| 107 | + </Page> |
| 108 | + </Frame> |
| 109 | + </TabViewItem> |
| 110 | + </TabView> |
| 111 | + </GridLayout> |
| 112 | + `, |
| 113 | + methods: { |
| 114 | + openWizard() { |
| 115 | + // show the wizard in a modal, and make sure it is fullscreen. |
| 116 | + this.$showModal(WizardModal, { |
| 117 | + fullscreen: true |
| 118 | + }).then(res => { |
| 119 | + console.log('wizard completed with res', res); |
| 120 | + }); |
| 121 | + } |
| 122 | + }, |
| 123 | +}).$start() |
| 124 | +*/ |
0 commit comments