<!DOCTYPE html> <html> <head> <title>第一个avalon项目</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script src="avalon.modern.js"></script> </head> <body ms-controller='root'> <div ms-include-src='page'></div> </body> <script> //头部 require(['avalon', 'domReady!'], function() {//第二块,添加根VM(处理共用部分) avalon.define({ $id: 'root', page: 'page' }) avalon.templateCache.page = "<div ms-controller='aaa'><input ms-duplex='username'/>{{username}}</div>" avalon.define({ $id: 'aaa', username: '司徒正美' }) }); </script> </html>