The steps to properly load "child.vue" into the correct position within "parent.vue" are as follows

Currently I am developing a single page web application using Vue.js. This app consists of 4 "page.vue" files, each with a right and left child .vue component nested inside.

For instance, the Page1.vue file is structured as follows (omitting style and script for brevity):

The child components, Page1Links and Page1Rechts, are intended to be loaded into the main section of the page. These two components were separated so that one can easily be replaced with a more complex version while keeping the other intact.

<template>
  <div>
    <div class="page-wrapper">
      <div class="page-container">
        <div class="page-header">
          <h1 id="page-h1"><span>Mauderer</span> Containertreppenkonfigurator</h1>
        </div>
        <div class="page-main-content">
          <Page1Links id="links"/>
          <Page1Rechts id="rechts"/>
        </div>
        <div class="page-footer">

        </div>
      </div>
    </div>
  </div>
</template>

I aim to have a header component spanning the full width of the page, followed by the two child components side by side, where the left component occupies 70% of the width and the right component occupies 30%. Finally, I want the footer to span the full width of the page.

However, my current layout displays all divs stacked at the top of the page in the following order: 1. header div 2. empty main div 3. footer div 4. child components (forced placement)

After attempting different design enhancements like adding box shadows, the child components still do not render within the main div but rather appear below the footer.

Upon receiving suggestions to use flexbox for better layout control, I realized that my issue lies in the rendering of child components outside of their designated main div.

If you refer to this example image, you'll notice that despite expecting the child components to render within the main part, they actually display after Page 1, below it.

Although BootstrapVue is included in my project, I may need to reconsider its usage if there's a simpler approach. Any guidance on resolving this rendering issue would be appreciated.

Answer №1

Can you show me your css code?

It seems like you want to display #links and #rechts next to each other, which can be achieved using flexbox.

.page-main-content{display: flex;}
#links{flex: 0 0 70%;}
#rechts{flex: 0 0 30%;}

Answer №2

After a few attempts, I finally got it to work and the solution was successful. However, I'm not entirely sure why it worked. The flex now pushes the children within page1 into the page-main-content.

I can see that this method is more efficient than what I previously tried (coding the size of the component within itself), but the components were originally positioned next to each other, so the flex forced the children to render inside the parent instead of below or after it.

Thank you for helping me solve the problem.

If anyone has a concise explanation, I would still be interested in understanding why this change occurred.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The full height of the image cannot be captured by html2canvas

It baffles me that html2canvas is failing to capture the full height of the div. html2canvas($container, { height: $container.height(), onrendered: function(canvas) { var data = canvas.toDataURL('image/png'); ...

When the bounds are adjusted, removing markers in Vue Cookbook's Google Map

I've encountered an issue with clearing markers after updating new bounds on a map. Whenever I post a request with new bounds, new markers get added to the map while the old ones remain in place. This situation becomes quite awkward for me because the ...

Sharing VueJS router with child component

How do I pass the router to my child component? This is my current router setup: import Vue from 'vue' import VueRouter from 'vue-router' Vue.use(VueRouter) export default function () { const Router = new VueRouter({ mode: ' ...

Is there a discrepancy in height between Chrome's mobile emulator and the iPhone simulator?

Currently, I am conducting a layout test for a PhoneGap application using the Framework7 framework across the Chrome mobile emulator (iPhone 6) and Xcode iOS simulator. However, I am facing difficulties with aligning the vertical layout on both simulators. ...

Is it time to swap out those divs for tables in your email template?

I have set up my template like this and I am questioning whether I should replace every div with a table. Let's start with the first div in the example. Do I really need to create a new table element, followed by tr and td tags just for a banner? I u ...

Transferring data to a child component through Route parameters

Although I have come across numerous questions and answers related to my query, I still seem unable to implement the solutions correctly. Every time I try, I end up with an 'undefined' error in my props. Let's take a look at my parent compo ...

Arranging elements on a webpage using CSS grid placements

Currently experimenting with css grid, envisioning a scenario where I have a 2x2 grid layout. When there are 4 child elements present, they would form 2 rows of 2 elements each. My challenge is when dealing with an odd number of children, I aim to avoid al ...

Having trouble with Electron JS and Vue Router configurations not properly packing with Electron Builder

Hello, I've been grappling with this issue for hours and can't seem to find a solution. I developed an Electron App using Vue 3 Composition and now I'm attempting to use Electron Builder for packaging. However, I keep encountering a white sc ...

Showing child elements within a div using AngularJS

I am eager to create a straightforward AngularJS website that will showcase an initially hidden HTML element along with all of its children. Below is the HTML structure snippet I plan to use: <div class="hiddenStuff"> <h3>Game Over</h3&g ...

Error: Required variable missing in AJAX Post request

When making an ajax call, I use the following code: o.open("POST",q,true); o.setRequestHeader("Content-type","application/x-www-form-urlencoded"); o.setRequestHeader("Content-length",p.length); o.setRequestHeader("Connection","close"); Here, q represent ...

Creating a collaborative storage space within a MERN project folder

Currently, I am developing an application using the MERN stack. The structure of my project repository includes both backend and frontend components: my-project/ ├── backend/ │ │ │ . │ . │ └── package.json ├── fronten ...

The process of loading and saving extensive data to the local storage of a user's Firefox browser involves extensive reading and writing operations

Our team has developed a sophisticated HTML5 offline application that houses a substantial amount of data, totaling tens of megabytes. We are looking for a way to allow users to save and retrieve copies of this data on their disk. While we have made some ...

Discovering the Secrets of Laravel 5: Harnessing the Power of Vue.js to Access Data Attribute Values

I'm a beginner in vue js. Within our app, we have implemented validation to check if a value already exists in the database. I would like to enhance this feature by making it dynamic. To achieve this, I have added a data attribute to my field which is ...

Utilize React's debounce feature in conjunction with updating state using

Introduction Let's discuss the popular debounce function provided by lodash. Imagine a scenario where a user rapidly enters values like 1, 12, 123, 1234. The debounce function ensures that only one alert, with the final value 1234, is triggered afte ...

The margin-bottom property does not cause the element to shift or re

Need help with creating a 3-line effect using div and before/after selectors. When applying margin-top in the after selector, the line moves down properly. However, when trying to move the line up using margin-bottom in the before selector, it's not w ...

Issue with excessive content causing scrolling difficulty

I've created CSS for a modal dialog, but I'm facing an issue. When the content exceeds the vertical space of the wrapper, the scrolling functionality doesn't work correctly. Although I can scroll, it's limited and I can't reach th ...

Encountering a fragment error while utilizing create-react-library

Recently, I embarked on the journey of publishing a React component to npm that I had created. In my quest for knowledge, I stumbled upon create-react-library, which I decided to use for the first time. As I started testing my component from the test folde ...

Prevent the link from stretching to cover the entire width of the page

I'm looking for a solution that can consistently restrict the clickable link area to just the text within my h2 element. The problem arises when the space to the right of the text is mistakenly included in the clickable region. Here's an example ...

Express JS redirect does not update the URL and fails to load static files

I'm currently developing an application using Express.js to build the REST interface on Node.js. Additionally, I am using jQuery Mobile for the client-side pages. One issue I am facing is with redirects when users try to access a restricted or inacce ...

Vue.js: Exploring the issue of filtering using v-if and v-for

I'm encountering an issue with a computed property in Vue.js that is being used in a v-if statement. I've been struggling to find a solution or refactor the code. Any guidance on this matter would be greatly appreciated. Situation: Currently, I ...