Where are legacy docs?#
Command errors in MS Windows#
Gradle errors in Android Studio#
license-gradle-plugin.jar may trigger errors, like
Connection reset or
peer not authenticated.
Maybe a network problem, try a proxy or VPN.
Use local image#
Weex’s native runtime support load image file from device’s disk, all you have to do set the file url like
file:///sdcard/image_new0.png. As to load image file in your project, Weex is not support yet.
The header content contains invalid characters) in windows#
This’s is caused by weex-toolkit’s dependency ‘http-server’, whose old version is not working well in chinese windows environment. We have fixed that, you should upgrade weex-toolkit before use that.
Playground app display nothing (white screen) after scan#
Best way to find out what’s happening is read debug log, you can follow this document to firgure out how to do that.
About ECMAScript Version#
Weex uses JSCore in iOS and uses v8 in Android. So they both support ECMAScript 5 spec. Additionally, we do some polyfills in native environment:
- Timer APIs (
clearInterval) in iOS/Android
In Browser we contains a polyfill of
Promise temporarily. In the future developers can choose whether to import a polyfill by configurations.
You can also write ES6 syntax by
webpack. The loader will convert ES6 syntax into ES5 automatically.
If you want more ES6 polyfills you can import them into the JS Bundle as you like.
Dependencies in frontend#
In Weex you may have some ways to import/require a component or a JS module. Take ES5 syntax for example:
require('xxx.js'): depends on a JS file
require('npm-module-name'): depends on a NPM module
require('xxx.we'): include a
wefile to register a Weex custom component
require('@weex-module/xxx'): depends on a Weex native module. Notice that it is supported only in
*.jsfile. If you want to use Weex native module in a
*.jsfile, temporarily you may write like this:
// use this piece of code below to get Weex native module "modal"
We will bring a better syntax design in the future.
iOS text line-height style is abnormal#
line-height style in text component is different from h5 and Android, text value will be placed at bottom of line box because of iOS native api. We are trying to optimize it.
overflow style in android is
hidden and cannot be changed. This is the result of Android View framework. This only happens on Android, iOS will work as expected.
How to get rid of 750 adaption and calculate width/height in real pixels？#
The deviceHeight and deviceWidth got in
this.$getConfig() is the real device width/height in pixels, not the ones with 750-adapted.
So you can use them to calculate width/height in real pixels.
Suppose you need to display a navigation bar of fixed 88 pixels, the bar’s height will be:
var height = 88 * 750 / env.deviceWidth
Detect native module#
var xxx = require('@weex-module/xxx')
Detect native component#
How to transfer data between pages#
If you have 2 pages, A and B.
How to use
repeat in Parent-Child components#
If you want, You can make a
repeat operation between Parent-Child components. But you must be strictly in accordance with the document syntax to write code. If there is no child component defined data, or there is no specify
props that need to be passed down. It will lead to the page does not render properly.
A correct example:
A wrong example：