Search code examples
iosflexboxweex

Weex: page show correct in web but incorrect in iOS device


I use weex to start a project, and the login.vue is like:

<template>
  <div class="login">
    <div class="images">1
    </div>
    <div class="centerPart">2
    </div>
    <div class="agree">3</div>
  </div>
</template>

<style scoped>
.login {
  display: flex;
  flex-direction: column;
  background-color: red;
}
.login :first-child{
  height: 250px;
}
.login :last-child{
  height: 200px;
}
.images {
  flex: 0 0 auto;
  background-color: aqua;
}
.centerPart{
  flex: 1 0 auto;
  background-color: yellow;
}
.agree {
  flex: 0 0 auto;
  background-color: coral;
}
</style>

<script>

</script>

When I run npm start, it shows like what I want in the browser: enter image description here

However, when I run weex run ios, the simulator show a blank page: enter image description here

I also try it in the device, and it shows a blank page, too.

So just wonder why it comes blank in the simulator and how can I find out the cause?


Solution

  • Weex doesn't support the complete flex shorthand syntax yet. You can only specify the flex-grow part.

    In your example, use flex: 1; in .centerPart and it should adjust its height.