Quellcode durchsuchen

[release] weex-vue-framework@2.0.5-weex.1

Evan You vor 9 Jahren
Ursprung
Commit
40c85f79a5

+ 15 - 20
packages/weex-template-compiler/build.js

@@ -5121,14 +5121,12 @@ function transformNode (el, options) {
   var ref = parseStaticClass(staticClass, options);
   var dynamic = ref.dynamic;
   var classResult = ref.classResult;
-  if (dynamic) {
-    if (process.env.NODE_ENV !== 'production') {
-      warn(
-        "class=\"" + staticClass + "\": " +
-        'Interpolation inside attributes has been deprecated. ' +
-        'Use v-bind or the colon shorthand instead.'
-      );
-    }
+  if (process.env.NODE_ENV !== 'production' && dynamic && staticClass) {
+    warn(
+      "class=\"" + staticClass + "\": " +
+      'Interpolation inside attributes has been deprecated. ' +
+      'Use v-bind or the colon shorthand instead.'
+    );
   }
   if (!dynamic && classResult) {
     el.staticClass = classResult;
@@ -5189,14 +5187,12 @@ function transformNode$1 (el, options) {
   var ref = parseStaticStyle(staticStyle, options);
   var dynamic = ref.dynamic;
   var styleResult = ref.styleResult;
-  if (dynamic) {
-    if (process.env.NODE_ENV !== 'production') {
-      warn(
-        "style=\"" + staticStyle + "\": " +
-        'Interpolation inside attributes has been deprecated. ' +
-        'Use v-bind or the colon shorthand instead.'
-      );
-    }
+  if (process.env.NODE_ENV !== 'production' && dynamic) {
+    warn(
+      "style=\"" + (String(staticStyle)) + "\": " +
+      'Interpolation inside attributes has been deprecated. ' +
+      'Use v-bind or the colon shorthand instead.'
+    );
   }
   if (!dynamic && styleResult) {
     el.staticStyle = styleResult;
@@ -5310,7 +5306,6 @@ function getTagNamespace$1 () { /* console.log('getTagNamespace') */ }
 var cache = Object.create(null);
 
 var baseOptions = {
-
   preserveWhitespace: false,
   modules: modules,
   staticKeys: genStaticKeys(modules),
@@ -5319,7 +5314,6 @@ var baseOptions = {
   isUnaryTag: isUnaryTag$1,
   mustUseProp: mustUseProp$1,
   getTagNamespace: getTagNamespace$1
-
 };
 
 function compile$1 (
@@ -5351,9 +5345,10 @@ function compile$$1 (
   options = options || {};
   var errors = [];
   // allow injecting modules/directives
+  var baseModules = baseOptions.modules || [];
   var modules = options.modules
-    ? baseOptions.modules.concat(options.modules)
-    : baseOptions.modules;
+    ? baseModules.concat(options.modules)
+    : baseModules;
   var directives = options.directives
     ? extend(extend({}, baseOptions.directives), options.directives)
     : baseOptions.directives;

+ 12 - 4
packages/weex-vue-framework/index.js

@@ -4252,16 +4252,20 @@ function updateClass (oldVnode, vnode) {
   }
 
   var oldClassList = [];
-  if (oldData.staticClass) {
-    oldClassList.push.apply(oldClassList, oldData.staticClass);
+  // unlike web, weex vnode staticClass is an Array
+  var oldStaticClass = oldData.staticClass;
+  if (oldStaticClass) {
+    oldClassList.push.apply(oldClassList, oldStaticClass);
   }
   if (oldData.class) {
     oldClassList.push.apply(oldClassList, oldData.class);
   }
 
   var classList = [];
-  if (data.staticClass) {
-    classList.push.apply(classList, data.staticClass);
+  // unlike web, weex vnode staticClass is an Array
+  var staticClass = data.staticClass;
+  if (staticClass) {
+    classList.push.apply(classList, staticClass);
   }
   if (data.class) {
     classList.push.apply(classList, data.class);
@@ -4274,6 +4278,8 @@ function updateClass (oldVnode, vnode) {
 }
 
 function getStyle (oldClassList, classList, ctx) {
+  // style is a weex-only injected object
+  // compiled from <style> tags in weex files
   var stylesheet = ctx.$options.style || {};
   var result = {};
   classList.forEach(function (name) {
@@ -4440,6 +4446,8 @@ Vue$1.prototype.$mount = function (
   return this._mount(el && query(el, this.$document), hydrating)
 };
 
+Vue$1.weexVersion = '2.0.5-weex.1';
+
 var instances = renderer.instances;
 var modules = renderer.modules;
 var components = renderer.components;

+ 2 - 0
src/entries/weex-framework.js

@@ -1,6 +1,8 @@
 import Vue from 'weex/runtime/index'
 import renderer from 'weex/runtime/config'
 
+Vue.weexVersion = '2.0.5-weex.1'
+
 const {
   instances,
   modules,