Skip to content

Commit

Permalink
Merge pull request #418 from Meituan-Dianping/develop
Browse files Browse the repository at this point in the history
new version 1.0.11
  • Loading branch information
aOrz authored May 4, 2018
2 parents 38e4118 + 3ceffd8 commit e8ae625
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 116 deletions.
36 changes: 18 additions & 18 deletions dist/vue.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ function handleError (err, vm, info) {
}

/* */
/* globals MutationObserver */

// can we use __proto__?
var hasProto = '__proto__' in {};
Expand Down Expand Up @@ -650,23 +649,23 @@ var nextTick = (function () {
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else if (typeof MutationObserver !== 'undefined' && (
isNative(MutationObserver) ||
// PhantomJS and iOS 7.x
MutationObserver.toString() === '[object MutationObserverConstructor]'
)) {
// use MutationObserver where native Promise is not available,
// e.g. PhantomJS IE11, iOS7, Android 4.4
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(String(counter));
observer.observe(textNode, {
characterData: true
});
timerFunc = function () {
counter = (counter + 1) % 2;
textNode.data = String(counter);
};
// } else if (typeof MutationObserver !== 'undefined' && (
// isNative(MutationObserver) ||
// // PhantomJS and iOS 7.x
// MutationObserver.toString() === '[object MutationObserverConstructor]'
// )) {
// // use MutationObserver where native Promise is not available,
// // e.g. PhantomJS IE11, iOS7, Android 4.4
// var counter = 1
// var observer = new MutationObserver(nextTickHandler)
// var textNode = document.createTextNode(String(counter))
// observer.observe(textNode, {
// characterData: true
// })
// timerFunc = () => {
// counter = (counter + 1) % 2
// textNode.data = String(counter)
// }
} else {
// fallback to setTimeout
/* istanbul ignore next */
Expand Down Expand Up @@ -4630,6 +4629,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
});

Vue$3.version = '2.4.1';
Vue$3.mpvueVersion = '1.0.8';

/* */

Expand Down
36 changes: 18 additions & 18 deletions dist/vue.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ function handleError (err, vm, info) {
}

/* */
/* globals MutationObserver */

// can we use __proto__?
var hasProto = '__proto__' in {};
Expand Down Expand Up @@ -648,23 +647,23 @@ var nextTick = (function () {
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else if (typeof MutationObserver !== 'undefined' && (
isNative(MutationObserver) ||
// PhantomJS and iOS 7.x
MutationObserver.toString() === '[object MutationObserverConstructor]'
)) {
// use MutationObserver where native Promise is not available,
// e.g. PhantomJS IE11, iOS7, Android 4.4
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(String(counter));
observer.observe(textNode, {
characterData: true
});
timerFunc = function () {
counter = (counter + 1) % 2;
textNode.data = String(counter);
};
// } else if (typeof MutationObserver !== 'undefined' && (
// isNative(MutationObserver) ||
// // PhantomJS and iOS 7.x
// MutationObserver.toString() === '[object MutationObserverConstructor]'
// )) {
// // use MutationObserver where native Promise is not available,
// // e.g. PhantomJS IE11, iOS7, Android 4.4
// var counter = 1
// var observer = new MutationObserver(nextTickHandler)
// var textNode = document.createTextNode(String(counter))
// observer.observe(textNode, {
// characterData: true
// })
// timerFunc = () => {
// counter = (counter + 1) % 2
// textNode.data = String(counter)
// }
} else {
// fallback to setTimeout
/* istanbul ignore next */
Expand Down Expand Up @@ -4628,6 +4627,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
});

Vue$3.version = '2.4.1';
Vue$3.mpvueVersion = '1.0.8';

/* */

Expand Down
36 changes: 18 additions & 18 deletions dist/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@ function handleError (err, vm, info) {
}

/* */
/* globals MutationObserver */

// can we use __proto__?
var hasProto = '__proto__' in {};
Expand Down Expand Up @@ -654,23 +653,23 @@ var nextTick = (function () {
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else if (typeof MutationObserver !== 'undefined' && (
isNative(MutationObserver) ||
// PhantomJS and iOS 7.x
MutationObserver.toString() === '[object MutationObserverConstructor]'
)) {
// use MutationObserver where native Promise is not available,
// e.g. PhantomJS IE11, iOS7, Android 4.4
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(String(counter));
observer.observe(textNode, {
characterData: true
});
timerFunc = function () {
counter = (counter + 1) % 2;
textNode.data = String(counter);
};
// } else if (typeof MutationObserver !== 'undefined' && (
// isNative(MutationObserver) ||
// // PhantomJS and iOS 7.x
// MutationObserver.toString() === '[object MutationObserverConstructor]'
// )) {
// // use MutationObserver where native Promise is not available,
// // e.g. PhantomJS IE11, iOS7, Android 4.4
// var counter = 1
// var observer = new MutationObserver(nextTickHandler)
// var textNode = document.createTextNode(String(counter))
// observer.observe(textNode, {
// characterData: true
// })
// timerFunc = () => {
// counter = (counter + 1) % 2
// textNode.data = String(counter)
// }
} else {
// fallback to setTimeout
/* istanbul ignore next */
Expand Down Expand Up @@ -4619,6 +4618,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
});

Vue$3.version = '2.4.1';
Vue$3.mpvueVersion = '1.0.8';

/* */

Expand Down
2 changes: 1 addition & 1 deletion dist/vue.min.js

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions dist/vue.runtime.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ function handleError (err, vm, info) {
}

/* */
/* globals MutationObserver */

// can we use __proto__?
var hasProto = '__proto__' in {};
Expand Down Expand Up @@ -646,23 +645,23 @@ var nextTick = (function () {
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else if (typeof MutationObserver !== 'undefined' && (
isNative(MutationObserver) ||
// PhantomJS and iOS 7.x
MutationObserver.toString() === '[object MutationObserverConstructor]'
)) {
// use MutationObserver where native Promise is not available,
// e.g. PhantomJS IE11, iOS7, Android 4.4
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(String(counter));
observer.observe(textNode, {
characterData: true
});
timerFunc = function () {
counter = (counter + 1) % 2;
textNode.data = String(counter);
};
// } else if (typeof MutationObserver !== 'undefined' && (
// isNative(MutationObserver) ||
// // PhantomJS and iOS 7.x
// MutationObserver.toString() === '[object MutationObserverConstructor]'
// )) {
// // use MutationObserver where native Promise is not available,
// // e.g. PhantomJS IE11, iOS7, Android 4.4
// var counter = 1
// var observer = new MutationObserver(nextTickHandler)
// var textNode = document.createTextNode(String(counter))
// observer.observe(textNode, {
// characterData: true
// })
// timerFunc = () => {
// counter = (counter + 1) % 2
// textNode.data = String(counter)
// }
} else {
// fallback to setTimeout
/* istanbul ignore next */
Expand Down Expand Up @@ -4626,6 +4625,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
});

Vue$3.version = '2.4.1';
Vue$3.mpvueVersion = '1.0.8';

/* */

Expand Down
36 changes: 18 additions & 18 deletions dist/vue.runtime.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ function handleError (err, vm, info) {
}

/* */
/* globals MutationObserver */

// can we use __proto__?
var hasProto = '__proto__' in {};
Expand Down Expand Up @@ -644,23 +643,23 @@ var nextTick = (function () {
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else if (typeof MutationObserver !== 'undefined' && (
isNative(MutationObserver) ||
// PhantomJS and iOS 7.x
MutationObserver.toString() === '[object MutationObserverConstructor]'
)) {
// use MutationObserver where native Promise is not available,
// e.g. PhantomJS IE11, iOS7, Android 4.4
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(String(counter));
observer.observe(textNode, {
characterData: true
});
timerFunc = function () {
counter = (counter + 1) % 2;
textNode.data = String(counter);
};
// } else if (typeof MutationObserver !== 'undefined' && (
// isNative(MutationObserver) ||
// // PhantomJS and iOS 7.x
// MutationObserver.toString() === '[object MutationObserverConstructor]'
// )) {
// // use MutationObserver where native Promise is not available,
// // e.g. PhantomJS IE11, iOS7, Android 4.4
// var counter = 1
// var observer = new MutationObserver(nextTickHandler)
// var textNode = document.createTextNode(String(counter))
// observer.observe(textNode, {
// characterData: true
// })
// timerFunc = () => {
// counter = (counter + 1) % 2
// textNode.data = String(counter)
// }
} else {
// fallback to setTimeout
/* istanbul ignore next */
Expand Down Expand Up @@ -4624,6 +4623,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
});

Vue$3.version = '2.4.1';
Vue$3.mpvueVersion = '1.0.8';

/* */

Expand Down
36 changes: 18 additions & 18 deletions dist/vue.runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ function handleError (err, vm, info) {
}

/* */
/* globals MutationObserver */

// can we use __proto__?
var hasProto = '__proto__' in {};
Expand Down Expand Up @@ -650,23 +649,23 @@ var nextTick = (function () {
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else if (typeof MutationObserver !== 'undefined' && (
isNative(MutationObserver) ||
// PhantomJS and iOS 7.x
MutationObserver.toString() === '[object MutationObserverConstructor]'
)) {
// use MutationObserver where native Promise is not available,
// e.g. PhantomJS IE11, iOS7, Android 4.4
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(String(counter));
observer.observe(textNode, {
characterData: true
});
timerFunc = function () {
counter = (counter + 1) % 2;
textNode.data = String(counter);
};
// } else if (typeof MutationObserver !== 'undefined' && (
// isNative(MutationObserver) ||
// // PhantomJS and iOS 7.x
// MutationObserver.toString() === '[object MutationObserverConstructor]'
// )) {
// // use MutationObserver where native Promise is not available,
// // e.g. PhantomJS IE11, iOS7, Android 4.4
// var counter = 1
// var observer = new MutationObserver(nextTickHandler)
// var textNode = document.createTextNode(String(counter))
// observer.observe(textNode, {
// characterData: true
// })
// timerFunc = () => {
// counter = (counter + 1) % 2
// textNode.data = String(counter)
// }
} else {
// fallback to setTimeout
/* istanbul ignore next */
Expand Down Expand Up @@ -4615,6 +4614,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
});

Vue$3.version = '2.4.1';
Vue$3.mpvueVersion = '1.0.8';

/* */

Expand Down
2 changes: 1 addition & 1 deletion dist/vue.runtime.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/mpvue-template-compiler/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4337,7 +4337,7 @@ var objectToStringVisitor = {
var key = keyStr ? hyphenate(keyStr) : keyStr;
var ref = generate(t.ExpressionStatement(propertyItem.value));
var val = ref.code;
return ("'" + key + ":' + " + (val.slice(0, -1)) + " + ';'")
return ("'" + key + ":' + (" + (val.slice(0, -1)) + ") + ';'")
}).join('+');

var p = template(expression)({});
Expand Down
2 changes: 1 addition & 1 deletion packages/mpvue-template-compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mpvue-template-compiler",
"version": "1.0.10",
"version": "1.0.11",
"description": "mpvue template compiler for Vue",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mpvue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mpvue",
"version": "1.0.10",
"version": "1.0.11",
"description": "Vue Runtime for mini program",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/mp/compiler/codegen/babel-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const objectToStringVisitor = {
const keyStr = getStrByNode(propertyItem.key, true)
const key = keyStr ? hyphenate(keyStr) : keyStr
const { code: val } = generate(t.ExpressionStatement(propertyItem.value))
return `'${key}:' + ${val.slice(0, -1)} + ';'`
return `'${key}:' + (${val.slice(0, -1)}) + ';'`
}).join('+')

const p = template(expression)({})
Expand Down
9 changes: 7 additions & 2 deletions test/mp/compiler/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,17 @@ describe('指令', () => {
it('v-bind:style', () => {
assertCodegen(
`<div v-bind:style="{ color: activeColor, fontSize: fontSize + 'px' }">111</div>`,
`<template name="a"><view class="_div" style=" {{('color:' + activeColor + ';' + 'font-size:' + fontSize + 'px' + ';')}}">111</view></template>`,
`<template name="a"><view class="_div" style=" {{('color:' + activeColor + ';' + 'font-size:' + (fontSize + 'px') + ';')}}">111</view></template>`,
{ name: 'a' }
)
assertCodegen(
`<div v-bind:style="{ color: a === b ? activeColor : color, fontSize: fontSize + 'px' }">111</div>`,
`<template name="a"><view class="_div" style=" {{( 'color:' + (a === b ? activeColor : color) + ';' + 'font-size:' + (fontSize + 'px') + ';')}}">111</view></template>`,
{ name: 'a' }
)
assertCodegen(
`<div v-bind:style="[{ color: activeColor, fontSize: fontSize + 'px' }]">111</div>`,
`<template name="a"><view class="_div" style=" {{['color:' + activeColor + ';' + 'font-size:' + fontSize + 'px' + ';']}}">111</view></template>`,
`<template name="a"><view class="_div" style=" {{['color:' + activeColor + ';' + 'font-size:' + (fontSize + 'px') + ';']}}">111</view></template>`,
{ name: 'a' }
)
assertCodegen(
Expand Down

0 comments on commit e8ae625

Please sign in to comment.