vue父子传值更新不及时
父级:
<!-- http采集器 --> <NodeHttp ref="http" :datanode="nodeData"></NodeHttp> import NodeHttp from '../node/NodeHttp.vue' components: { NodeHttp, }, //点击传值 nodeClick(){ this.nodeData = '222'; }
子级:
<script> export default { name: 'http', props: { datanode: Object, // cancel: Function }, data() { return { visible: false, setting: this.datanode, } }, watch: { datanode(val) { this.setting = val; 需要监听 } }, created() { }, methods: { show() { this.visible = true; }, hide() { this.visible = false }, } } </script>