NativeScript Vue Frame navigateTo not navigating










0















[edit] -> Playground Link



I am using NativeScript and Vue to create an app. Once it loads, I want to show a login page, or navigate somewhere else if the user has previously logged in.
My page loads but doesn't navigate to the login page. This is being run in an IOS emulator.



<template>
<Page>
<RadSideDrawer ref="drawer" showOverNavigation="true">
<StackLayout ~drawerContent backgroundColor="#ffffff">
<Label class="drawer-header" text="Drawer"/>

<Label class="drawer-item" text="Static 1"/>
<Label class="drawer-item" text="Static 2"/>
<Label class="drawer-item" text="Static 3"/>
</StackLayout>
<Frame ~mainContent>
<Page> <!-- test to see if mainContent navigates -->
<TextField class="input" hint="Email" keyboardType="email" autocorrect="false" autocapitalizationType="none" v-model="user.email"
returnKeyType="next" fontSize="18" />
</Page>
</Frame>
</RadSideDrawer>
</Page>
</template>

<script>
import homePage from './HomePage'
import loginPage from './LoginPage'

export default
data()
return
isLoggingIn: true,
user:
email: "foo@foo.com",
password: "foo",
confirmPassword: "foo"

;
,
mounted()
this.user.email = "test@example.com", <!-- Change email to check mounted is called. It is! -->
this.$navigateTo(loginPage, frame: "mainContent" )

;
</script>


I cannot work out what I am doing wrong and cannot work out from the source either. Any help/suggestions would be greatly appreciated.










share|improve this question




























    0















    [edit] -> Playground Link



    I am using NativeScript and Vue to create an app. Once it loads, I want to show a login page, or navigate somewhere else if the user has previously logged in.
    My page loads but doesn't navigate to the login page. This is being run in an IOS emulator.



    <template>
    <Page>
    <RadSideDrawer ref="drawer" showOverNavigation="true">
    <StackLayout ~drawerContent backgroundColor="#ffffff">
    <Label class="drawer-header" text="Drawer"/>

    <Label class="drawer-item" text="Static 1"/>
    <Label class="drawer-item" text="Static 2"/>
    <Label class="drawer-item" text="Static 3"/>
    </StackLayout>
    <Frame ~mainContent>
    <Page> <!-- test to see if mainContent navigates -->
    <TextField class="input" hint="Email" keyboardType="email" autocorrect="false" autocapitalizationType="none" v-model="user.email"
    returnKeyType="next" fontSize="18" />
    </Page>
    </Frame>
    </RadSideDrawer>
    </Page>
    </template>

    <script>
    import homePage from './HomePage'
    import loginPage from './LoginPage'

    export default
    data()
    return
    isLoggingIn: true,
    user:
    email: "foo@foo.com",
    password: "foo",
    confirmPassword: "foo"

    ;
    ,
    mounted()
    this.user.email = "test@example.com", <!-- Change email to check mounted is called. It is! -->
    this.$navigateTo(loginPage, frame: "mainContent" )

    ;
    </script>


    I cannot work out what I am doing wrong and cannot work out from the source either. Any help/suggestions would be greatly appreciated.










    share|improve this question


























      0












      0








      0








      [edit] -> Playground Link



      I am using NativeScript and Vue to create an app. Once it loads, I want to show a login page, or navigate somewhere else if the user has previously logged in.
      My page loads but doesn't navigate to the login page. This is being run in an IOS emulator.



      <template>
      <Page>
      <RadSideDrawer ref="drawer" showOverNavigation="true">
      <StackLayout ~drawerContent backgroundColor="#ffffff">
      <Label class="drawer-header" text="Drawer"/>

      <Label class="drawer-item" text="Static 1"/>
      <Label class="drawer-item" text="Static 2"/>
      <Label class="drawer-item" text="Static 3"/>
      </StackLayout>
      <Frame ~mainContent>
      <Page> <!-- test to see if mainContent navigates -->
      <TextField class="input" hint="Email" keyboardType="email" autocorrect="false" autocapitalizationType="none" v-model="user.email"
      returnKeyType="next" fontSize="18" />
      </Page>
      </Frame>
      </RadSideDrawer>
      </Page>
      </template>

      <script>
      import homePage from './HomePage'
      import loginPage from './LoginPage'

      export default
      data()
      return
      isLoggingIn: true,
      user:
      email: "foo@foo.com",
      password: "foo",
      confirmPassword: "foo"

      ;
      ,
      mounted()
      this.user.email = "test@example.com", <!-- Change email to check mounted is called. It is! -->
      this.$navigateTo(loginPage, frame: "mainContent" )

      ;
      </script>


      I cannot work out what I am doing wrong and cannot work out from the source either. Any help/suggestions would be greatly appreciated.










      share|improve this question
















      [edit] -> Playground Link



      I am using NativeScript and Vue to create an app. Once it loads, I want to show a login page, or navigate somewhere else if the user has previously logged in.
      My page loads but doesn't navigate to the login page. This is being run in an IOS emulator.



      <template>
      <Page>
      <RadSideDrawer ref="drawer" showOverNavigation="true">
      <StackLayout ~drawerContent backgroundColor="#ffffff">
      <Label class="drawer-header" text="Drawer"/>

      <Label class="drawer-item" text="Static 1"/>
      <Label class="drawer-item" text="Static 2"/>
      <Label class="drawer-item" text="Static 3"/>
      </StackLayout>
      <Frame ~mainContent>
      <Page> <!-- test to see if mainContent navigates -->
      <TextField class="input" hint="Email" keyboardType="email" autocorrect="false" autocapitalizationType="none" v-model="user.email"
      returnKeyType="next" fontSize="18" />
      </Page>
      </Frame>
      </RadSideDrawer>
      </Page>
      </template>

      <script>
      import homePage from './HomePage'
      import loginPage from './LoginPage'

      export default
      data()
      return
      isLoggingIn: true,
      user:
      email: "foo@foo.com",
      password: "foo",
      confirmPassword: "foo"

      ;
      ,
      mounted()
      this.user.email = "test@example.com", <!-- Change email to check mounted is called. It is! -->
      this.$navigateTo(loginPage, frame: "mainContent" )

      ;
      </script>


      I cannot work out what I am doing wrong and cannot work out from the source either. Any help/suggestions would be greatly appreciated.







      nativescript nativescript-vue






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 22:22







      Pieter

















      asked Nov 15 '18 at 20:57









      PieterPieter

      1,0111121




      1,0111121






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You haven't set an id to your Frame inside RadSideDrawer.



          In order for your this.$navigateTo code to work, the frame declaration suppose to be



          ...
          <Frame id="mainContent" ~mainContent>
          ...


          Edit:



          I have updated your Playground sample.




          • Page can only be the child of Frame. So I had to update your LoginPage.vue or HomePage.vue to hold a Page.

          • If I'm not wrong RadSideDrawer internally overwrites the ref for mainContent (not sure though), so id works better here.

          • When the component is mounted, it doesn't mean all components inside are mounted too. So I had to add a timeout. I'm not sure why you really want to navigate as soon page is loaded, instead you can embed login / home page component within Frame as default page.





          share|improve this answer

























          • It doesn't make any difference for me. The documentation states it could be Id or Ref although the code indicates Id is used. Neither works for me.

            – Pieter
            Nov 15 '18 at 21:29






          • 1





            I'm not a Vue expert but as far as I know, using ~ is not equivalent to id or ref I guess. If neither ref or id works, I would suggest you to prepare a Playground sample so it could be easier to debug.

            – Manoj
            Nov 15 '18 at 21:37











          • Thank you. I have added a playground link (never thought of it). I have read somewhere that ~ is short for ref but cannot find it. Maybe I was wrong. Ref and Id doesn't work for me.

            – Pieter
            Nov 15 '18 at 22:34











          • Thank you! It makes more sense to me now. The idea with the immediate navigation is that a home page is loaded, but navigated to login if the user's token expired (or not logged in for another reason). The defaultPage property made the app crash.

            – Pieter
            Nov 16 '18 at 10:33











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327803%2fnativescript-vue-frame-navigateto-not-navigating%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You haven't set an id to your Frame inside RadSideDrawer.



          In order for your this.$navigateTo code to work, the frame declaration suppose to be



          ...
          <Frame id="mainContent" ~mainContent>
          ...


          Edit:



          I have updated your Playground sample.




          • Page can only be the child of Frame. So I had to update your LoginPage.vue or HomePage.vue to hold a Page.

          • If I'm not wrong RadSideDrawer internally overwrites the ref for mainContent (not sure though), so id works better here.

          • When the component is mounted, it doesn't mean all components inside are mounted too. So I had to add a timeout. I'm not sure why you really want to navigate as soon page is loaded, instead you can embed login / home page component within Frame as default page.





          share|improve this answer

























          • It doesn't make any difference for me. The documentation states it could be Id or Ref although the code indicates Id is used. Neither works for me.

            – Pieter
            Nov 15 '18 at 21:29






          • 1





            I'm not a Vue expert but as far as I know, using ~ is not equivalent to id or ref I guess. If neither ref or id works, I would suggest you to prepare a Playground sample so it could be easier to debug.

            – Manoj
            Nov 15 '18 at 21:37











          • Thank you. I have added a playground link (never thought of it). I have read somewhere that ~ is short for ref but cannot find it. Maybe I was wrong. Ref and Id doesn't work for me.

            – Pieter
            Nov 15 '18 at 22:34











          • Thank you! It makes more sense to me now. The idea with the immediate navigation is that a home page is loaded, but navigated to login if the user's token expired (or not logged in for another reason). The defaultPage property made the app crash.

            – Pieter
            Nov 16 '18 at 10:33
















          0














          You haven't set an id to your Frame inside RadSideDrawer.



          In order for your this.$navigateTo code to work, the frame declaration suppose to be



          ...
          <Frame id="mainContent" ~mainContent>
          ...


          Edit:



          I have updated your Playground sample.




          • Page can only be the child of Frame. So I had to update your LoginPage.vue or HomePage.vue to hold a Page.

          • If I'm not wrong RadSideDrawer internally overwrites the ref for mainContent (not sure though), so id works better here.

          • When the component is mounted, it doesn't mean all components inside are mounted too. So I had to add a timeout. I'm not sure why you really want to navigate as soon page is loaded, instead you can embed login / home page component within Frame as default page.





          share|improve this answer

























          • It doesn't make any difference for me. The documentation states it could be Id or Ref although the code indicates Id is used. Neither works for me.

            – Pieter
            Nov 15 '18 at 21:29






          • 1





            I'm not a Vue expert but as far as I know, using ~ is not equivalent to id or ref I guess. If neither ref or id works, I would suggest you to prepare a Playground sample so it could be easier to debug.

            – Manoj
            Nov 15 '18 at 21:37











          • Thank you. I have added a playground link (never thought of it). I have read somewhere that ~ is short for ref but cannot find it. Maybe I was wrong. Ref and Id doesn't work for me.

            – Pieter
            Nov 15 '18 at 22:34











          • Thank you! It makes more sense to me now. The idea with the immediate navigation is that a home page is loaded, but navigated to login if the user's token expired (or not logged in for another reason). The defaultPage property made the app crash.

            – Pieter
            Nov 16 '18 at 10:33














          0












          0








          0







          You haven't set an id to your Frame inside RadSideDrawer.



          In order for your this.$navigateTo code to work, the frame declaration suppose to be



          ...
          <Frame id="mainContent" ~mainContent>
          ...


          Edit:



          I have updated your Playground sample.




          • Page can only be the child of Frame. So I had to update your LoginPage.vue or HomePage.vue to hold a Page.

          • If I'm not wrong RadSideDrawer internally overwrites the ref for mainContent (not sure though), so id works better here.

          • When the component is mounted, it doesn't mean all components inside are mounted too. So I had to add a timeout. I'm not sure why you really want to navigate as soon page is loaded, instead you can embed login / home page component within Frame as default page.





          share|improve this answer















          You haven't set an id to your Frame inside RadSideDrawer.



          In order for your this.$navigateTo code to work, the frame declaration suppose to be



          ...
          <Frame id="mainContent" ~mainContent>
          ...


          Edit:



          I have updated your Playground sample.




          • Page can only be the child of Frame. So I had to update your LoginPage.vue or HomePage.vue to hold a Page.

          • If I'm not wrong RadSideDrawer internally overwrites the ref for mainContent (not sure though), so id works better here.

          • When the component is mounted, it doesn't mean all components inside are mounted too. So I had to add a timeout. I'm not sure why you really want to navigate as soon page is loaded, instead you can embed login / home page component within Frame as default page.






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 15 '18 at 22:52

























          answered Nov 15 '18 at 21:19









          ManojManoj

          6,8012923




          6,8012923












          • It doesn't make any difference for me. The documentation states it could be Id or Ref although the code indicates Id is used. Neither works for me.

            – Pieter
            Nov 15 '18 at 21:29






          • 1





            I'm not a Vue expert but as far as I know, using ~ is not equivalent to id or ref I guess. If neither ref or id works, I would suggest you to prepare a Playground sample so it could be easier to debug.

            – Manoj
            Nov 15 '18 at 21:37











          • Thank you. I have added a playground link (never thought of it). I have read somewhere that ~ is short for ref but cannot find it. Maybe I was wrong. Ref and Id doesn't work for me.

            – Pieter
            Nov 15 '18 at 22:34











          • Thank you! It makes more sense to me now. The idea with the immediate navigation is that a home page is loaded, but navigated to login if the user's token expired (or not logged in for another reason). The defaultPage property made the app crash.

            – Pieter
            Nov 16 '18 at 10:33


















          • It doesn't make any difference for me. The documentation states it could be Id or Ref although the code indicates Id is used. Neither works for me.

            – Pieter
            Nov 15 '18 at 21:29






          • 1





            I'm not a Vue expert but as far as I know, using ~ is not equivalent to id or ref I guess. If neither ref or id works, I would suggest you to prepare a Playground sample so it could be easier to debug.

            – Manoj
            Nov 15 '18 at 21:37











          • Thank you. I have added a playground link (never thought of it). I have read somewhere that ~ is short for ref but cannot find it. Maybe I was wrong. Ref and Id doesn't work for me.

            – Pieter
            Nov 15 '18 at 22:34











          • Thank you! It makes more sense to me now. The idea with the immediate navigation is that a home page is loaded, but navigated to login if the user's token expired (or not logged in for another reason). The defaultPage property made the app crash.

            – Pieter
            Nov 16 '18 at 10:33

















          It doesn't make any difference for me. The documentation states it could be Id or Ref although the code indicates Id is used. Neither works for me.

          – Pieter
          Nov 15 '18 at 21:29





          It doesn't make any difference for me. The documentation states it could be Id or Ref although the code indicates Id is used. Neither works for me.

          – Pieter
          Nov 15 '18 at 21:29




          1




          1





          I'm not a Vue expert but as far as I know, using ~ is not equivalent to id or ref I guess. If neither ref or id works, I would suggest you to prepare a Playground sample so it could be easier to debug.

          – Manoj
          Nov 15 '18 at 21:37





          I'm not a Vue expert but as far as I know, using ~ is not equivalent to id or ref I guess. If neither ref or id works, I would suggest you to prepare a Playground sample so it could be easier to debug.

          – Manoj
          Nov 15 '18 at 21:37













          Thank you. I have added a playground link (never thought of it). I have read somewhere that ~ is short for ref but cannot find it. Maybe I was wrong. Ref and Id doesn't work for me.

          – Pieter
          Nov 15 '18 at 22:34





          Thank you. I have added a playground link (never thought of it). I have read somewhere that ~ is short for ref but cannot find it. Maybe I was wrong. Ref and Id doesn't work for me.

          – Pieter
          Nov 15 '18 at 22:34













          Thank you! It makes more sense to me now. The idea with the immediate navigation is that a home page is loaded, but navigated to login if the user's token expired (or not logged in for another reason). The defaultPage property made the app crash.

          – Pieter
          Nov 16 '18 at 10:33






          Thank you! It makes more sense to me now. The idea with the immediate navigation is that a home page is loaded, but navigated to login if the user's token expired (or not logged in for another reason). The defaultPage property made the app crash.

          – Pieter
          Nov 16 '18 at 10:33




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327803%2fnativescript-vue-frame-navigateto-not-navigating%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          27

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          Category:Rhetoric