文档详情

《Vue.js前端开发技术与实践(第二版)》 课件 第4章 Vue指令.pptx

发布:2024-11-25约小于1千字共26页下载文档
文本预览下载声明

第4章Vue指令;??;hello;hello;style=color:red;元素;v-text

v-html

v-show

v-if

v-else

v-else-if

v-for

v-on

v-bind

v-model

v-slot

v-pre

v-once

v-memo

v-cloak;一、指令语法;二、操控DOM内容;1、全局属性id、class、title、style、hidden等等;在Vue中,动态的样式类在“v-on:class”中定义,静态的类名写在class样式中。;*表达式;在Vue中,动态的样式类在“v-on:class”中定义,静态的类名写在class样式中。;$event事件对象

.stop阻止事件冒泡

.capture事件流为捕获事件流

.self只接收自触发事件

.prevent阻止默认事件

;插槽slot;5、操控表单(v-model);student={?

??name:tom,//设置属性

??age:20,?//设置属性

??say:function(){

????alert(helloworld!)

??}//设置方法

};;;它带有前缀v-,主要职责是当其表达式的值改变时,相应地将某些行为应用在DOM上。;scriptsetup

??

/script

template

?div

??

?/div

/template

style

?

/style;;App.vue;import{createApp}fromvue;globals:{

defineProps:readonly,defineEmits:readonly,defineExpose:readonly,withDefaults:readonly,},

显示全部
相似文档