ThomasLeconte / vuetify3-dialog

Vue 3 & Vuetify 3 plugin to create dialogs (confirm, warn, error), toasts or bottom-sheets with Promises anwsers.
https://www.npmjs.com/package/vuetify3-dialog
MIT License
25 stars 8 forks source link

How to use HTML text #19

Open baedorf opened 4 months ago

baedorf commented 4 months ago

It's great to have a library able to open vuetify dialogs in js scripts. I wonder if it is possible and how to render HTML.

ThomasLeconte commented 4 months ago

Hello, I don't really understand what you're want exactly, can you provide an example of what you would want ?

baedorf commented 4 months ago

I'd like to use html formated text

Do you really want to set next state of tailoring?<br/>After setting to next state neither requirements can be changed nor tailoring be deleted!<br/><br/>In case you need to downstate call your administrator

usinig vuei18n in

confirmDialog({
        title: "Warning",
        text: t("tailoring_state.text"),
        cancelText: t("no"),
        confirmationText: t("yes"),
        icon: mdiAlertCircleOutline
    }).
    icon: mdiAlertCircleOutline,
})

to see text formated as

Do you really want to set next state of tailoring?
After setting to next state neither requirements can be changed nor tailoring be deleted!

In case you need to downstate call your administrator

babsey commented 3 months ago

I like your work vuetify3-dialog. So simple usage and best efforts. As @baedorf mentioned, it would be nice that html-formatted string text can be rendered in dialogs.

As example for snackbar:

https://github.com/ThomasLeconte/vuetify3-dialog/blob/8f6d54a75a462e9558fa1f423befcef6cfd1ec55/src/components/Snackbar.vue#L49

could be written in

<span v-html="text" />
ramseyfeng commented 2 weeks ago

Adding a Pull Request (PR) to support this feature.

Instead of displaying all content as HTML, adding a flag to indicate whether it should be enabled is preferable.

ramseyfeng commented 1 week ago

@baedorf @babsey you can display HTML content in 1.5.3 in the following way:

this.$notify.create({
        text: "Hello world!",
        htmlContent: `<a href="#">hello</a>`,
        notifyOptions: {
          timeout: 3000,
          location: 'top right'
        }
      })
babsey commented 1 week ago

Great! It works well. Many Thanks! :+1: