Edit 10/7/2020: I couldn't ever get this to work. Ended up falling back to ASP.NET Razor server rendering, despite it not being what I wanted for this component. If anyone has any ideas in the future, I'm all ears.
So, I'm making a single file component that represents a notification panel on my site. The site is mostly generated server side with ASP.NET Core's Razor view engine. This notification panel will be the second Vue component added to the site, as it needs to be a bit more reactive/responsive than a server rendered component will allow us.
The component has no style defined in it's definition, rather the component uses the global site.css added in the <head> tag.
Onto the issue...
I'm noticing some very strange behavior with Vue 3's component rendering. Below is a sanitized version of my component:
NotificationPanel.vue
<template>
<div class="custom-item-inner custom-rounded">
<p class="custom-h2style">
Notifications
</p>
<div class="custom-section-divide">
<p class="custom-section-title">Section Title</p>
<p class="custom-desc">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec porttitor, odio sit amet volutpat pretium.</p>
<div class="custom-item-link">
Perform Action
</div>
</div>
</div>
</template>
<script>
export default {
name: "notifications-panel",
data() {
return {
placeholder: ""
}
},
mounted() {
console.log("Hello world");
}
}
</script>
My expectation is that this would render to the component to the page and the globally defined CSS would get applied to this markup. Instead, I'm seeing a warning in the developer console:
The white line that the arrow is pointing to is the component's container, which is defined in CSHTML. The component itself is not rendered, but was definitely mounted, judging by console output.
Here's the weird part: If I remove class="custom-section-title" from the <p> tag in the middle of my template, this is what gets rendered:
What on earth is happening? This makes absolutely zero sense to me...
Any ideas? Thanks
Extra details:
- This is how the component is being used in the cshtml code.
<!-- Notifications Block-->
<div class="col-12 col-lg-4 col-xl-3 sidenav custom-item custom-notifys">
<notifications-panel />
</div>
- in
main.js, I'm importingcreateAppfrom 'vue/dist/vue.esm-browser', which was explained to me here.

