ProgressNS / nativescript-ui-feedback

This repository is used for customer feedback regarding Telerik UI for NativeScript. The issues system here is used by customers who want to submit their feature requests or vote for existing ones.
Other
115 stars 21 forks source link

[RadSideDrawer] Allow DrawerContent to be changed in App. #1348

Closed EdJones closed 4 years ago

EdJones commented 4 years ago

Please, provide the details below:

Tell us about the problem

Need to be able to replace sidedrawer content.

Which platform(s) does your issue occur on?

Both

Please provide the following version numbers that your issue occurs with:

Please tell us how to recreate the issue in as much detail as possible.

  1. Start the application ..
  2. Navigate through a series of sidedrawer items and their corresponding pages.
  3. At some point, select a new section (page), e.g. PartTwo. Sidedrawer contents could then be replaced with a new DrawerContentP2 from DrawerContentP2.vue .

The drawerContent property for RadSideDrawer seems to hold this. But it's not clear how to set this mid-app. (Using {N}-Vue).

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

(You can paste entire code snippets, link to playground demo or attach a runnable project)

EdJones commented 4 years ago

I was able to achieve the desired effect by creating a sidedrawer that is only a placeholder, that is, holds a component with variable content. Thanks to Allegator.io for explaining Swappable Dynamic Components

<template>
    <component :is="dynamicComponent"></component>
</template>

<script>

import DrawerContentL1 from "./DrawerContentL1";
import DrawerContentL2 from "./DrawerContentL2";

export default {
  components: {
    DrawerContentL1,
    DrawerContentL2
  },
  computed: {
    dynamicComponent() {
      if(this.$store.state.currentLevel=="L1") {
        return 'DrawerContentL1';
      } else {
        return 'DrawerContentL2';
      }
    }
  }
}
</script>`