【问题标题】:How to get refs object in vue after an aspx page is submitted提交aspx页面后如何在vue中获取refs对象
【发布时间】:2020-01-26 09:59:02
【问题描述】:

我正在将一个 ASPX 页面转换为 vue。所有的 vue 组件都正确加载,我也得到了 refs 对象

`<test-report ref="testReport" ></test-report>
<script>
method:{
 Loaded:{
    this.objResult = this.refs.testReport 
   }
},

`

但是在提交 ASPX 页面后,我需要在 vue 组件中显示一些其他数据,但 refs 对象显示未定义。我需要在该对象中调用另一个函数,但它显示为未定义。

`<script>
method:{
 AfterLoaded:{
     this.objResult = this.refs.testReport  //showing undefined
   }
},
</script>`

请帮忙

【问题讨论】:

    标签: vue.js vue-component


    【解决方案1】:

    在您的情况下尝试使用 this.$refs.nameOfRefthis.$refs.testReport

    【讨论】:

    • 我已经做到了,但我无法在该 vue 组件“testReport”中调用该函数。它只会显示 HTML 元素
    猜你喜欢
    • 2016-02-18
    • 2010-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-30
    • 1970-01-01
    • 2013-08-23
    • 2011-09-10
    相关资源
    最近更新 更多