Incorporating a custom component within a Vue.js dialog box

I have implemented a custom component using the Vue.js plugin found at https://github.com/Godofbrowser/vuejs-dialog

Despite following the guide provided, I am facing an issue where the Dialog appears but does not display any content or the custom component. Additionally, the configuration settings do not seem to be taking effect.

Could there be something that I am overlooking? I have carefully followed the documentation provided.

Below is the snippet from my main.js:

import VuejsDialog from 'vuejs-dialog';
import 'vuejs-dialog/dist/vuejs-dialog.min.css';

Vue.use(VuejsDialog);

import CustomView from '@/components/HDSLogin';
const customView = 'my-unique-view-name';
Vue.dialog.registerComponent(customView, CustomView)

Subsequently, I am utilizing the following method within my component in order to trigger the dialog

this.$dialog.alert( {
    view: customView,
    html: false,
    animation: 'fade',
    okText: "Ok",
    cancelText: "Cancel",
    backdropClose: true
});

Furthermore, I have defined my CustomView component within HdsLogin.vue:

<template>
    <div>
        <p>Content</p>
    </div>
</template>

<script>
// Importing necessary modules
import Vue from 'vue';
import VuejsDialog from 'vuejs-dialog';
import VuejsDialogMixin from 'vuejs-dialog/dist/vuejs-dialog-mixin.min.js'; 
import 'vuejs-dialog/dist/vuejs-dialog.min.css';
Vue.use(VuejsDialog);

export default {
  mixins: [VuejsDialogMixin],
};
</script>

<style scoped="">
button {
  width: 100%;
  margin-bottom: 10px;
  float: none;
}
</style>

Despite the above configuration, only a blank dialog is being displayed:

https://i.sstatic.net/55ho4.png

Answer №1

this.$dialog.alert() requires 2 parameters, and its structure is as follows:

Plugin.prototype.alert = function (message = null, options = {}) {
    message && (options.message = message)
    return this.open(DIALOG_TYPES.ALERT, options)
}
null for example) before setting the options.

-  this.$dialog.alert( {
+  this.$dialog.alert(null, {
    view: customView, // can be set globally too
    html: false,
    animation: 'fade',
    okText: "Ok",
    cancelText: "Cancel",
    backdropClose: true
  });
HdsLogin component.

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 variable 'document.prodimage' does not exist or is not a valid object

Encountering a JavaScript error in IE8 on Windows 7 when loading the page: document.prodimage is null or not an object. I have excluded my custom dynamic code responsible for API calls to fetch data, which populates elements such as images & links based o ...

Having trouble retrieving POST data with NodeJS/Express and an HTML form?

I have encountered an issue in my application where I am unable to extract the posted data from req after performing an action pointing to a nodejs endpoint. Despite successfully executing the action, when attempting to access the posted data from req, I a ...

JavaScript popup displaying incorrectly

In my experience, I have completed two web-related classes that involved similar projects with popups using HTML and JavaScript. However, I am facing an issue where the popup either does not show at all or appears for only a brief moment before closing its ...

While iterating over the key with a variable in a loop, only one property is displayed consistently instead of four different

Currently, I am working on creating an address book using JavaScript. The problem I am facing is that the properties of my objects are not providing me with the necessary information. I need 4 different properties instead of 4 loops with the same property. ...

inject a $scope object into a view when a button is clicked

Right now, I am using an array as a $scope object $scope.data { item1: "Value", item2: "Value Alt" } Every item corresponds to a form input with a default value. My goal is to create a new form from the same data set upon an ng-click event while main ...

Using a JavaScript loop to modify the color of the final character in a word

I am curious to find out how I can dynamically change the color of the last character of each word within a <p> tag using a Javascript loop. For example, I would like to alter the color of the "n" in "John", the "s" in "Jacques", the "r" in "Peter" ...

Unveiling the ApplePay token with VueJS

I'm facing an issue with decrypting the ApplePay token in my Vue app, using a specific package. The error message I'm receiving is quite puzzling and I'm struggling to comprehend it. Simply checking if the package is installed by running th ...

Having trouble reaching the vue binary through my command line interface

Encountering some difficulties while attempting to set up Vue CLI on my Mac. I prefer working with yarn instead of npm in the terminal. These are the commands I used: yarn global add @vue/cli Upon installation, a success message appeared in the terminal. ...

Express encountered an issue with NodeJS: Unable to modify headers after they have been sent to the client

I am facing an issue with a project that involves calling an external API to retrieve data. This API call happens in two steps - first, I send my data and then wait for the result which takes 6-12 seconds. To make this process smoother, I have implemented ...

Employ AJAX to dynamically refresh the page whenever a new row is inserted into the table

Currently, I am in the midst of learning AJAX because it is necessary for a project I am working on. The aim is to refresh a feed in real-time whenever a new row is added to a MYSQL table. While I have successfully achieved this using node.js, my client&ap ...

The Protractor Custom Locator is experiencing difficulty in finding the element

For our project, the automation team is incorporating a custom attribute called 'lid' to elements where unique identification is challenging. A new custom locator method has been developed to find elements using the 'lid' attribute: ...

Steps for concealing a div element upon clicking on it

Is there a way to create an accordion where all the tabs start off closed, but open when clicked and close when clicked again? I have managed to open one tab, but I am struggling to figure out how to close it and how to make the opening and closing process ...

What purpose does the div tagged with the class selection_bubble_root serve in Nextjs react?

Just starting out with Nextjs and setting up a new Next.js React project. I used create-next-app to initialize the code base, but then noticed an odd div tag with the class 'selection_bubble_root' right inside the body. Even though its visibility ...

Having difficulty in focusing on a textarea upon page initialization

I've been attempting to focus on a syncfusion textarea without success. Even after using this.$nextTick when the component mounts as instructed here, the textarea still doesn't receive focus. I also tried adding the same "focus to textarea" code ...

I'm looking to display a text box on my website specifically for users using IE11

I'm following up on my previous post that was put on hold. I encountered some issues with my website in IE11, which are now resolved. However, I want to implement a code snippet that will display a text box if any similar problems arise in the future ...

ReactJS - When a child component's onClick event triggers a parent method, the scope of the parent method may not behave as anticipated

In my current setup, I have a parent component and a child component. The parent component contains a method within its class that needs to be triggered when the child component is clicked. This particular method is responsible for updating the store. Howe ...

Submitting a file using Ajax XMLHttpRequest

Currently, I am facing an issue while attempting to send a file using the following XMLHttpRequest code. var url= "http://localhost:80/...."; $(document).ready(function(){ document.getElementById('upload').addEventListener('cha ...

When updating a value using v-model, the entire table is refreshed

As I was working on creating an editable table, I noticed a significant slowdown in performance once the number of rows exceeded 100. This prompted me to investigate the issue further. In the scenario below, every time the input value is changed, the enti ...

Having trouble loading items in a <select> tag with Jquery?

Dealing with a seemingly simple issue, I am struggling to figure out how to load items into a select using jQuery. Working with the Materialize theme available at: The code snippet in question: <div class="input-field col s12"> <s ...

Issue with element event processing while Material-ui Popup is visible

I am working with a basic material-ui List that contains several ListItem elements. The goal is to have a Popover appear next to the ListItem whenever the mouse hovers over it. To achieve this, I am using the mouseEnter event. In the event handler, I desi ...