批改状态:合格
老师批语:
挂载实例<div class="app"><p>用户名:{{username}}</p></div>const app = Vue.createApp({data(){return{username:'王老师',};},}).mount('.app');
数据注入console.log(app.username);
响应式app.username = '张老师';

<p>用户名: <span v-text="username"></span></p><p>用户名: <span v-html="username"></span></p>

动态值<p v-bind:style="{color:textColor,backgroundColor:bgc}">php</p>行内样式对象<p v-bind:style="[base,custom]">php123</p>
<p :class="{active: isActive}">hello 老师123</p><p :class="[mycolor,mybgc]">hello 老师456</p>
<script>const app = Vue.createApp({data(){return{//style: 'color:blue;',textColor: 'blue',bgc:'wheat',base:{border:'1px solid',background:'#e0ff00'},custom:{color:'white',padding:'15px',},active: 'active',isActive: true,mycolor: 'active',mybgc: 'bgc'};},}).mount('.app');</script>

<p><input type="text" @input="comment = $event.target.value " :value="comment"><span>{{comment}}</span></p>

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号