refs.uvue 601 字节
Newer Older
crlfe's avatar
crlfe 已提交
1 2
<template>
  <view class="page">
crlfe's avatar
crlfe 已提交
3
    <view ref="node">NodeRef: {{existRef}}</view>
crlfe's avatar
crlfe 已提交
4 5 6 7
<!--    <child ref="component">ComponentRef</child>-->
  </view>
</template>

H
hdx 已提交
8
<script>
crlfe's avatar
crlfe 已提交
9 10 11 12 13 14
// import child from './child.uvue'

export default {
  // components: {
  //   child
  // },
crlfe's avatar
crlfe 已提交
15 16 17 18 19
  data () {
    return {
      existRef: false
    }
  },
crlfe's avatar
crlfe 已提交
20
  mounted () {
crlfe's avatar
crlfe 已提交
21 22 23 24
    const nodeRef = this.$refs.get('node')

    this.existRef = nodeRef !== null

DCloud-WZF's avatar
DCloud-WZF 已提交
25
//    console.log(this.$refs)
crlfe's avatar
crlfe 已提交
26 27 28 29 30 31 32 33 34 35 36 37
  }
}
</script>

<style>
  .row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin-bottom: 10px;
  }
</style>