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?
大家讲道理2017-05-18 10:51:57
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 if
,Vue语法直接设置v-if
或v-show
Vue
v-if
or v-show
will do the trick. 🎜