两种方法

  1. 用传统的methods方法

this.$emit(“方法名”,要传递的参数)

  1. 使用vue3新的方法

推荐第二种方法,更加符合vue3的风格

 emits: ["todata"],
 setup(props, {emit}) {
   const change = () => {
     const params = {
      	user:"ylw"
     };
     emit("todata", params);
   };
}
Logo

前往低代码交流专区

更多推荐