1.0.36 • Published 5 years ago

weex-vue-render v1.0.36

Weekly downloads
270
License
Apache-2.0
Repository
github
Last release
5 years ago

weex-vue-render

Web renderer for weex project. Support Vue 2.x syntax.

build vuejs2.x pkg down Package Quality

How To Use

We strongly suggest you use v1.x instead of 0.12.x, according to performance issue.

npm install weex-vue-render
// import vue runtime.
const Vue = require('vue/dist/vue.runtime.common').default
// import weex-vue-render
const weex = require('weex-vue-render')
// init the weex instance.
weex.init(Vue)
// import your .vue App.
const App = require('App.vue')
// must have a '#root' element in your html body.
App.$el = '#root'
// instantiate
new App()

The way to require ES modules and CommonJS modules may have a slice of difference between different versions of Vue and Vue-loader, and this is totally depending on Vue and the loader, so please check out related documents.

If your import the UMD formated bundle to the html, then you dont't have to call init manually.

<script>{{Vue runtime}}</script>
<script>{{weex-vue-render}}</script>
<script>{{your web.bundle.js}}</script>

pack your .vue file to web.bundle.js

You should pack your web.bundle.js and native.bundle.js separately. Use weex-loader for native packing and use vue-loader for web packing.

Use vue-loader to pack your code for web.bundle.js.

If you are using weex-vue-render@1.x , You should definitely use below plugins to get things work:

  • weex-vue-precompiler
  • autoprefixer
  • postcss-plugin-weex
  • postcss-plugin-px2rem

We use weex-vue-precompiler instead of $processStyle in 1.x verison.

Now, how to use this plugins to pack you web.bundle.js ? We use them in the vue-loader option.

Here is a vue-loader option example:

{ // webpack config.
  vue: {
    optimizeSSR: false,
    postcss: [
      // to convert weex exclusive styles.
      require('postcss-plugin-weex')(),
      require('autoprefixer')({
        browsers: ['> 0.1%', 'ios >= 8', 'not ie < 12']
      }),
      require('postcss-plugin-px2rem')({
        // base on 750px standard.
        rootValue: 75,
        // to leave 1px alone.
        minPixelValue: 1.01
      })
    ],
    compilerModules: [
      {
        postTransformNode: el => {
          // to convert vnode for weex components.
          require('weex-vue-precompiler')()(el)
        }
      }
    ]
  }
}

You should use a .js file as your webpack entry, not the Main.vue or App.vue file.

The content of your entry file main.js should be like this:

// import Vue runtime if you like.
// import weex-vue-render if you like.
// init weex if you imported it.
// at least it should have this:
import App from './your/App.vue'
App.el = '#root'
new Vue(App)

How to Migrate from 0.12.x to 1.x

Why should I update to 1.x ?

The answer is enoumouse change in rendering performance with a few minor updates in your code is definitely worth to try.

packing configuration

You should use the previous mentioned plugins in your vue-loader configuration.

check your code

categoryrules0.12.x1.x
render functioncreate weex component in render functionsupportsupported in >=1.0.11
event bindingbind native events for custom component's root element@click@click.native doc
stylesstyle bindingnonebetter performance for binding object literal like :style="{width:w,height:h}" instead of object variable like :style="someObj"
styles in animation.transitionnoneshould add css prefix manualy if needed. We suggest you use transition to implement animation.
exclusive styleslimitnonewirte them in <style> tag for better performance.
wx unitsupportonly in binding style (will fix soon)
refwhat this.$refs.xx will getalways instance of VueComponentHTMLElement for div, image and text; VueComponent for other components.

Develop

# build for weex-vue-render package
npm run build
# debug and serve examples
npm run dev
# build and run test cases
npm run test
1.0.36

5 years ago

1.0.35

5 years ago

1.0.34

5 years ago

0.12.32

6 years ago

0.12.31

6 years ago

0.12.30

6 years ago

0.12.29

6 years ago

1.0.33

6 years ago

1.0.32

6 years ago

0.12.28

6 years ago

1.0.31

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

0.12.27

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.12.26

6 years ago

0.12.25

7 years ago

0.12.24

7 years ago

0.12.23

7 years ago

0.12.22

7 years ago

0.12.21

7 years ago

0.12.20

7 years ago

0.12.19

7 years ago

0.12.18

7 years ago

0.12.17

7 years ago

0.12.16

7 years ago

0.12.15

7 years ago

0.12.14

7 years ago

0.12.13

7 years ago

0.12.12

7 years ago

0.12.11

7 years ago

0.12.10

7 years ago

0.12.9

7 years ago

0.12.8

7 years ago

0.12.7

7 years ago

0.12.6

7 years ago

0.12.5

7 years ago

0.12.4

7 years ago

0.12.3

7 years ago

0.12.2

7 years ago

0.12.1

7 years ago

0.12.0-beta.1

7 years ago

0.11.57

7 years ago

0.11.56

7 years ago

0.11.55

7 years ago

0.11.54

7 years ago

0.11.53

7 years ago

0.11.52

7 years ago

0.11.51

7 years ago

0.11.50

7 years ago

0.11.49

7 years ago

0.11.48

7 years ago

0.11.47

7 years ago

0.11.46

7 years ago

0.11.45

7 years ago

0.11.44

7 years ago

0.11.43

7 years ago

0.11.42

7 years ago

0.11.41

7 years ago

0.11.40

7 years ago

0.11.39

7 years ago

0.11.38

7 years ago

0.11.37

7 years ago

0.11.36

7 years ago

0.11.35

7 years ago

0.11.34

7 years ago

0.11.33

7 years ago

0.11.32

7 years ago

0.11.31

7 years ago

0.11.30

7 years ago

0.11.29

7 years ago

0.11.28

7 years ago

0.11.27

7 years ago

0.11.26

7 years ago

0.11.25

7 years ago

0.11.24

7 years ago

0.11.23

7 years ago

0.11.22

7 years ago

0.11.21

7 years ago

0.11.20

7 years ago

0.11.19

7 years ago

0.11.18

7 years ago

0.11.17

7 years ago

0.11.16

7 years ago

0.11.15

7 years ago

0.11.14

7 years ago

0.11.13

7 years ago

0.11.12

7 years ago

0.11.11

7 years ago

0.11.10

7 years ago

0.11.9

7 years ago

0.11.8

7 years ago

0.11.7

7 years ago

0.11.6

7 years ago

0.11.5

7 years ago

0.11.4

7 years ago

0.11.3

7 years ago

0.11.2

7 years ago

0.11.1

7 years ago

0.11.0

7 years ago

0.10.4

7 years ago

0.10.3

7 years ago

0.10.2

7 years ago

0.10.1

7 years ago

0.10.0

7 years ago

0.2.0

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.1.0-beta.2

7 years ago

0.1.0-beta.1

7 years ago

0.1.0-beta.0

7 years ago