weex_extend_demo
This is a simple demo for weex to extend a self-defined component on web platform using weex-html5. In this demo we use the created component named 'mine' and installed it to run.
The other repo weex-hello contains the code of component's defining and specifying its attribute, style and events. You can set up your attribute setters, style setters and event configuration in your component's implementation, and also override the methods like 'create' of the base class 'Component'.
STEPS to demonstrate
npm install
npm run transform
npm run build
npm run serve
- visit
http://localhost:12580/index.html
, then you'll see the demo page.
STEPS for extending
- require the
weex-html5
to do all the rendering work. - you can publish your self-defined component in npm. In this demo, we use the already published component
weex-hello
in our project. You can go to the repo of weex-hello-web to see the component's defining code. - in your bootstrap file, import the component and install it.
- do the initializing work for rendering
.we
page. It's all in thesrc/main.js
file. - visit the page.