In the project Vue.js in the 1.x version of the switch to the 2.x version of the problem is that when the 1.x version is instantiated, the DOM string inside the script will not be filtered out, but the 2.x version will be filtered for example:
Script content after the 1.x version is instantiated
Script content after the 2.x version is instantiated
So we can't get to the DOM structure when we get id= "sh" content, and many times we want to use these DOM constructs.
So, after a test and a document review, if you haven't been fully instantiated yet, then we're going to get it so we can get the DOM that hasn't been filtered yet?
Yes created method, so the following code has been completed.
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Document</title></Head><Body><Divclass= "App"> <Scripttype= "Text/x-template"ID= "sh"> <Div> <H1>1111</h1> <P>{{msg}}</p> </div> </Script> <Button@click= "SetData">Audit</Button></Div><Scriptsrc= "Jquery.min.js"></Script><Scriptsrc= "Vue.min.2.x.js"></Script><Script> NewVue ({el:'. App', Data: {msg:NULL, shhtml:NULL}, created:function(){ This. GETSCRIPTDOMSTR (); }, methods: {getscriptdomstr:function(){ This. shhtml=document.getElementById ('SH'). InnerHTML}, SetData:function(){ $('. App'). Append ('<div id= "TPL" ></div>') var_self= This; NewVue ({el:'#tpl', Data: {msg: $}, Template: _self.shhtml}) }})</Script></Body></HTML>
Vue.js 2.x version script the DOM is filtered to get a solution that does not have a DOM string