Weex Vue Framework

2.5.15-weex.2 · deprecated · verified Sun Apr 19

weex-vue-framework is a package that provides the Vue 2.0 framework for use with Weex, a platform enabling developers to build Android, iOS, and Web apps from a single codebase using modern web development skills. This package is an "auto-generated" component of the Vue.js ecosystem, specifically tailored for the Weex environment. The current stable version of the underlying Vue 2 series is 2.7.16, known as "Swan Song", which marked the final official release for Vue 2. It reached its End of Life (EOL) on December 31st, 2023, meaning it no longer receives new features, updates, or official security fixes. As such, this package, being intrinsically tied to Vue 2, is effectively deprecated. Its primary differentiator is its role in enabling Vue 2 applications to render natively on Weex-powered mobile environments, extending Vue's capabilities beyond the browser to native UI rendering.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a basic Vue 2 Single File Component (SFC) designed for a Weex environment. It shows a simple counter with reactive data and a method to update it, along with Weex-specific styling considerations like explicit dimensions. The `main.js` illustrates the entry point, including the Weex framework annotation and the instantiation of the Vue root component. This setup assumes `weex-vue-framework` is providing the underlying Vue 2 runtime when `import Vue from 'vue'` is called within a Weex project context.

/* file: src/App.vue */
<template>
  <div class="wrapper">
    <text class="message">Hello Weex with Vue 2!</text>
    <text class="counter">Count: {{ count }}</text>
    <button @click="increment" class="button">
      <text class="button-text">Increment</text>
    </button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      count: 0
    }
  },
  methods: {
    increment () {
      this.count++
      console.log('Count incremented to:', this.count)
    }
  }
}
</script>

<style scoped>
  .wrapper {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 800px; /* Weex requires explicit dimensions */
    background-color: #f0f0f0;
  }
  .message {
    font-size: 48px;
    text-align: center;
    margin-bottom: 30px;
    color: #333;
  }
  .counter {
    font-size: 36px;
    color: #666;
    margin-bottom: 40px;
  }
  .button {
    background-color: #42b983;
    padding: 20px 40px;
    border-radius: 10px;
  }
  .button-text {
    color: #ffffff;
    font-size: 32px;
  }
</style>

/* file: src/main.js - entry file for Weex build */
// The 'use weex:vue' directive is crucial for Weex to identify the framework.
// { "framework": "Vue" } // Alternative for Weex v0.16 and earlier

import Vue from 'vue'; // In a Weex project, this resolves to the Weex-adapted Vue runtime
import App from './App.vue';

// Weex requires the root element to be specified for the Vue instance.
// The #root element is typically provided by the Weex rendering environment.
new Vue({
  el: '#root',
  render: h => h(App)
});

// This example assumes a build process using weex-loader or similar,
// which bundles the .vue file into a JavaScript bundle for native Weex rendering.
// You would typically run 'weex create myapp' and then build/run the project.
// e.g., 'npm run build' and 'weex run android' or 'weex run ios'.

view raw JSON →