1.0.6 • Published 2 years ago
vue-template-ast v1.0.6
vue-template-ast
安装
npm install vue-template-ast
使用
const tplAst=require("vue-template-ast")
let tpl="<template><div>hello</div></template>"
//处理标签节点
let resolveTpl= tplAst.resolve(tpl,o=>{
//为input标签增加 属性 key='value'
if(o.name==='input'){
o.attrs.push({
type:"string", // string or boolean
name:"key",
value:"'value'"
})
}
})