Vue中一个方法调用另一个方法的变量
先将需要的值在点击事件中传进来<el-button type="primary" size="small" @click="handleUpdate(itemSon.userId)">修改照片</el-button>在data中定义空值id: null;在方法中接收所传参数handleUpdate(e) {this.reset();this.open = true;this
·
先将需要的值在点击事件中传进来
<el-button type="primary" size="small" @click="handleUpdate(itemSon.userId)">修改照片</el-button>
在data中定义空值
id: null;
在方法中接收所传参数
handleUpdate(e) {
this.reset();
this.open = true;
this.id = e;//将e保存到id内
}
在其他方法中直接调用this.id
就可以拿到了。
简而言之就是将数据保存到data内。
更多推荐
已为社区贡献5条内容
所有评论(0)