01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 | html: "<div id="test">texttext</div>" //html转换成ast ast: { // 标签类型 type: 1, // 标签名 tag: "div", // 标签行内属性列表 attrsList: [{name: "id", value: "test"}], // 标签行内属性 attrsMap: {id: "test"}, // 标签关系 父亲 parent: undefined, // 字标签属性列表 children: [{ type: 3, text: 'texttext' } ], plain: true, attrs: [{name: "id", value: "'test'"}] } |
1 2 3 4 5 6 7 8 9 | <template> <div id="test"> {{val}} <img src="http://xx.jpg"> </div> </template> //最后输出 {render: "with(this){return _c('div',{attrs:{"id":"test"}},[[_v(_s(val))]),_v(" "),_m(0)])}"} |
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |