javascript - weex When extending native components, how to locate components at the same level? Can you hide or show an adjacent component?
伊谢尔伦
伊谢尔伦 2017-05-18 10:49:57
0
1
407

After tracing the android code, I found that it was impossible to obtain the class flag for positioning through DomObject.
<text class="hi></text>
<my_component></my_component>
If my component needs to respond to an event or gesture, I need to hide the component with class hi text component. Can it be implemented in the native layer?
Or do we have to trigger the corresponding js event and let js handle it?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
大家讲道理

Getting references is relatively simple:
WeexSyntax:

<template>
 <p>
  <text id="test">test</text>
 </p>
</template>
<script>
module.exports = {
  methods: {
   testMethod: function () {
      var top = this.$el('test')
    }
  }
}
</script>

VueSyntax:

<template>
 <p>
  <text ref="test">test</text>
 </p>
</template>
<script>
export default {
  methods: {
   testMethod () {
      var top = this.$refs.test
    }
  }
}
</script>

Also, the display and hiding you mentioned is actually relatively simple. There is no need to obtain a reference. The Weex syntax directly uses if, and the ifVue语法直接设置v-ifv-showVue

syntax directly sets v-if or v-show will do the trick. 🎜
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template