this.$nextTick(回调函数)
handleEdit(todo) {// todo.isEdit = true;if (todo.hasOwnProperty("isEdit")) {todo.isEdit = true;} else {this.$set(todo, "isEdit", "true");}/* setTimeout(()=>{this.$refs.inputTitle.focus();}, 200); */// this.$nextTick(function() {this.$refs.inputTitle.focus();});
},
样式准备:
使用<transition></transition>
包裹要过度的元素,并配置name属性
<transition name="hello"><h1 v-show="isShow">内容</h1>
</transition>
注意:若多个元素需要过度,则需要使用
<transition-group></transition-group>
进行包裹,且每个子元素都要指定key值
App组件
<template><div><Test/><Test2/><Test3/></div>
</template><script>import Test from './components/Test'import Test2 from './components/Test2'import Test3 from './components/Test3'export default {name: "App",// 注册组件components: {Test, Test2,Test3},}
</script>
Test组件
<template><div><button @click="isShow = !isShow">显示/隐藏</button><!-- <transition><h1 v-show="isShow" >你好啊!</h1></transition> --><!-- <transition name="myTransition" :appear="true"> --><transition name="myTransition" appear><h1 v-show
本文发布于:2024-01-31 13:58:21,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170668070229023.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |