摘要: 1、全局代码App.vue如下 <script setup> import Testpage001 from './view/Testpage001.vue' import Testpage002 from './view/Testpage002.vue' </script> <template> 阅读全文
posted @ 2024-08-10 23:20 像一棵海草海草海草 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <div ref="container" class="container">{{ caption }}</div> <input type="text" ref="username"> <button @click="getElementHandle">获取元 阅读全文
posted @ 2024-08-10 22:51 像一棵海草海草海草 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下 <template> <h3>表单输入绑定</h3> <form> <!-- 编辑框内容变化时候,下面标签同步显示编辑框内容--> <input type="text" v-model:="username"> <P>{{ username }}</P> <!-- 编辑框内容变化时候, 阅读全文
posted @ 2024-08-10 22:44 像一棵海草海草海草 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 01、代码如下: <template> <h3>侦听器</h3> <div>{{ msg }}</div> <button @click="undateHandle">修改</button> </template> <script> export default { data() { return 阅读全文
posted @ 2024-08-10 22:06 像一棵海草海草海草 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <div :style="{color:activeColor,fontSize:fontsize+'px'}">Style绑定1</div> <div :style="styleObject">Style绑定2</div> <div :style="[styl 阅读全文
posted @ 2024-08-10 21:58 像一棵海草海草海草 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1、App.vue代码如下: <script setup> import Testpage001 from './view/Testpage001.vue' </script> <template> <Testpage001/> </template> <style> </style> 2、如图所示 阅读全文
posted @ 2024-08-10 21:48 像一棵海草海草海草 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <h3>class绑定</h3> <div :class="{ 'active':isActive , 'text-danger':hasError }">Class样式绑定1</div> <div :class="classObject">Class样式绑定2 阅读全文
posted @ 2024-08-10 21:33 像一棵海草海草海草 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <h3>计算属性</h3> <div>{{ func1 }}</div> <div>{{ func1 }}</div> <div>{{ func1 }}</div> <!-- <div>{{ func1() }}</div>--> <!-- <div>{{ fu 阅读全文
posted @ 2024-08-10 18:29 像一棵海草海草海草 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <h3>数组变化侦听</h3> <button @click="addListHandle">添加数据</button> <ul> <li v-for="(item,index) of names" :key="index">{{ item }}</li> </ 阅读全文
posted @ 2024-08-10 18:10 像一棵海草海草海草 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <h3>事件修饰符</h3> <a @click.prevent="clickHandle" href="http://www.baidu.com">百度</a> <div @click="click1"><p @click="click2">测试1</p></ 阅读全文
posted @ 2024-08-10 17:48 像一棵海草海草海草 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下 <template> <h3>事件传参</h3> <p @click="getNameHandler(item,$event)" v-for="(item,index) of names" :key="index">{{ item }}</p> </template> <script> 阅读全文
posted @ 2024-08-10 17:34 像一棵海草海草海草 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <h3>内联事件处理群</h3> <button @click="addCount1">Add</button> <p>{{ count1 }}</p> <button @click="addCount2('hello')">按钮</button> <p>{{ 阅读全文
posted @ 2024-08-10 17:12 像一棵海草海草海草 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <h3>内联事件处理群</h3> <button @click="addCount">Add</button> <p>{{ count }}</p> </template> <script> export default { data() { return { 阅读全文
posted @ 2024-08-10 17:03 像一棵海草海草海草 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <h3>列表渲染</h3> <p v-for="(item,index) of names">序号:{{ index }},内容:{{ item }} </p> <div v-for="item of result"> <p>ID:{{ item.id }}, 阅读全文
posted @ 2024-08-10 16:29 像一棵海草海草海草 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 01、代码如下: <template> <button @click="isCn = !isCn">转换</button> <h1 v-if="isCn">十年一梦学Vue!</h1> <h1 v-else>Ten years of dreaming of Vue!</h1> </template> 阅读全文
posted @ 2024-08-10 15:59 像一棵海草海草海草 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <div v-bind:id="myId1" v-bind:class="testCls" v-bind="objAttrs">测试1</div> </template> <script> export default { data() { return { t 阅读全文
posted @ 2024-08-10 15:01 像一棵海草海草海草 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <div v-bind:id="myId1" v-bind:class="testCls">测试1</div> <div v-bind:id="myId2" v-bind:title="testTitle">测试2</div> <div :id="myId3" 阅读全文
posted @ 2024-08-10 14:55 像一棵海草海草海草 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <div v-bind:id="myId" v-bind:class="testCls">测试</div> </template> <script> export default { data() { return { testCls: "appclass", 阅读全文
posted @ 2024-08-10 14:43 像一棵海草海草海草 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1、代码如下: <template> <h3>模板语法</h3> <p>{{ msg }}</p> <p>{{ msg_cn }}</p> <p>{{ number + 1 }}</p> <p>{{ ok ? 'Yes' : 'No' }}</p> <p>{{ message.split("").r 阅读全文
posted @ 2024-08-10 14:33 像一棵海草海草海草 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1、在App.vue中写入下面的代码 <template> <h3>模板语法</h3> <p>{{ msg }}</p> <p>{{ msg_cn }}</p> </template> <script> export default { data() { return { msg: "Hello W 阅读全文
posted @ 2024-08-10 14:31 像一棵海草海草海草 阅读(7) 评论(0) 推荐(0) 编辑