Node.js/nuxt:修订间差异
来自康健生活
| 第115行: | 第115行: | ||
* [Function (anonymous)] | * [Function (anonymous)] | ||
*: 匿名函数 | *: 匿名函数 | ||
* Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "whetherJumpUploadInfo" | |||
*: 通过 props 传递给子组件的 whetherJumpUploadInfo,不能在子组件内部修改 props 中的 whetherJumpUploadInfo 值。 | |||
*:<syntaxhighlight lang="html5"> | |||
父组件 | |||
<div :whetherJumpUploadInfo="whetherJumpUploadInfo" @jumpUploadInfo="jumpUploadInfo"></div> | |||
子组件 | |||
<template> | |||
... | |||
</template> | |||
<script> | |||
export default { | |||
... | |||
props: { | |||
whetherJumpUploadInfo: { | |||
type: Boolean, | |||
default: () => false | |||
} | |||
}, | |||
methods:{ | |||
uploadOnProgress (){ | |||
// this.whetherJumpUploadInfo = true | |||
this.$emit('jumpUploadInfo'); //通知父组件改变 | |||
} | |||
} | |||
}</syntaxhighlight> | |||