SOURCE

var str = '<el-tag type="success">标签二</el-tag>'
var str2 = "<el-progress :percentage='100' status='success'></el-progress>"
var str3 = '<el-avatar size="mini" src="http://ccccccccc.com"></el-avatar>'
var vnoed = {
    tag: '',
    props: {},
    children: ''
}
function transVnode(str) {
    //props:{type="success",...},
    //tag:"el-tag"
    //children:'标签二'
    var regChild = /^>(.*)<$/;
    var child = str.match(regChild)
    if (child) {
        vnoed.children = str.match(regChild)[1]
    }
    var regTag = /<([\w-]*)[\s\/]/;
    vnoed.tag = str.match(regTag)[1]

    var regProps = /([\w-:]*)=['"](\w*)['"]/g
    var myArray;
    while ((myArray = regProps.exec(str)) !== null) {
        if (myArray[1].includes(':')) {
            vnoed.props[myArray[1].slice(1)] = Number(myArray[2])
        } else {
            vnoed.props[myArray[1]] = myArray[2]
        }
    }
    console.log(vnoed)
}
transVnode(str2)
console 命令行工具 X clear

                    
>
console