2020
09-24
09-24
Vue2.4+新增属性.sync、$attrs、$listeners的具体使用
sync在vue2.4以前,父组件向子组件传值用props;子组件不能直接更改父组件传入的值,需要通过$emit触发自定义事件,通知父组件改变后的值。比较繁琐,写法如下://父组件<template><divclass="parent"><p>父组件传入子组件的值:{{name}}</p><fieldset><legend>子组件</legend><child:val="name"@update="modify"></child></fieldset></div></template><script>importChildfrom'./Child'exportdefault{c...
继续阅读 >