How to add pseudo-class style to render function in vue functional component

problem description

export default {
    functional: true,
    props: {
        data: {
            type: String,
            default() {
                return "";
            }
        },
        depth: {
            type: Number
        }
    },
    render: (h, ctx) => {
        return h("div", {
            class: ["treeitem"],
            style: {
                ":hover": {
                    background: "yellow"  // div
                },
                height: "40px",
                lineHeight: "40px",
                border: "1px solid -sharpf0f0f0",
                "marginLeft": ctx.props.depth*20 + "px"
            },
            on: {
                click: () => {
                },
                mouseover: () => {
                }
            }
        }, [
            h("Icon", {
                props: {
                    type: "arrow-right-b",
                },
                style: {
                    marginLeft: "20px",
                    display: "inline-block",
                    width: "40px",
                    hight: "40px"
                }
            }),
            h("span",{
                style: {
                }
            }, ctx.props.data),
            h("Button", {
                props: {
                    icon: "ios-gear-outline"
                },
                style: {
                    float: "right" 
                },
                on: {
                    click: () => {
                    }
                }
            })
        ]);
    }
}

the environmental background of the problems and what methods you have tried

try to add class, to the div element, but as a functional component, this is the js file. Where should I write the style?

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Mar.28,2021

it is recommended to bind to class


it is recommended to operate through class, and then select pseudo class


via class.

this is not a problem with vue. Currently, the inline style does not support writing pseudo-classes

.

you can try to add a style tag to head

const styleEl = document.createElement('style')
styleEl.innerHTML = `
  .treeitem:hover{
    background: yellow;
  }
`
document.head.appendChild(styleEl)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30c05-2bd56.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30c05-2bd56.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?