<div>Message: {{ msg }}</div>
<div id='app'> <div>{{ str }}</div> <button @click='str = "Iubesc Viata"'>Click</button> </div> <script> var vm = new Vue({ el: '#app', data: {str: 'Sunt Eu insumi.'} }) </script>
v-html
.<div id='app'> <p>Without directive: {{ str_html }}</p> <p>Using v-html directive: <span v-html="str_html"></span></p> </div> <script> var vm = new Vue({ el: '#app', data: {str_html: '<b style="color:#00f">Sunt Eu insumi.</b>'} }) </script>
Sintaxa cu acolade duble nu se foloseste in atribute HTML.
{{ number + 1 }} {{ ok ? 'YES' : 'NO' }} {{ message.split('').reverse().join('') }} <div v-bind:id="'list-' + id"></div>- Exemplu, arata numarul de clicuri pe un buton:
<div id='app'> <div>Number of licks: {{ nr}}</div> <button @click='nr +=1'>Click</button> </div> <script> var vm = new Vue({ el: '#app', data: {nr: 0} }) </script>
<div id='app'> <p>{{ msg.split('').reverse().join('') }}</p> Add some text in this input:<br> <input v-model='msg'> </div> <script> var vue_ob = new Vue({ el: '#app', data: {msg: 'Hello Vue!'} }) </script>
<ul> <li>http://coursesweb.net/html/</li> <li>http://www.marplo.net/html/</li> </ul>
.some_class { display: list-item; }
var obj = { "courses": ["php", "javascript", "ajax"] }; var jsonstr = JSON.stringify(obj); alert(jsonstr); // {"courses":["php","javascript","ajax"]}
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>'; $dochtml = new DOMDocument(); $dochtml->loadHTML($strhtml); $elm = $dochtml->getElementById("dv1"); echo $elm->nodeValue; // CoursesWeb.net
I`m living here. - Traiesc /Locuiesc aici.
Estoy viviendo aquĆ. - Traiesc /Locuiesc aici.