1 .模板文件的地址pagespublicpublic.wxml
2 .模板文件的代码
template name=' staff name ' view first name/view/template3.导入和使用模板文件
! -index.wxml----! -导入模板文件--import src=' ./public/public.wxml '/view class=' container ' view class=' userinfo ' button wx 330 取得' open-type=' get userinfo ' bindgetuserinfo=' get userinfo '头像的昵称/buttonblockwx : elseimagebindtap=' bindviewtap ' class=' userinfo-avatar ' src=' { userinfo.avatar URL } ' mode imagetextclass=' userinfo-nickname ' { userinfo.nickname }/text/block/viewviewclass=' user motto ' text clask -使用模板文件--template is=' staff name ' data=' { . staffa } }/templatetemplateis=' staff name ' data={ . staff name } 使用的templatetemplateis=' staff name ' data=' { . staffc } '/template/viewimportsrc=' ./public/public.wxml '