Skip to content

Commit

Permalink
feat(h5-vue): wxs(__wxsClass,__wxsStyle)
Browse files Browse the repository at this point in the history
  • Loading branch information
fxy060608 committed Aug 23, 2019
1 parent 80ad204 commit 7aeb8cc
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 40 deletions.
26 changes: 21 additions & 5 deletions packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.common.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,9 @@ var Observer = function Observer (value) {
def(value, '__ob__', this);
if (Array.isArray(value)) {
if (hasProto) {
protoAugment(value, arrayMethods);
{
protoAugment(value, arrayMethods);
}
} else {
copyAugment(value, arrayMethods, arrayKeys);
}
Expand Down Expand Up @@ -6792,7 +6794,8 @@ function updateClass (oldVnode, vnode) {
isUndef(oldData.staticClass) &&
isUndef(oldData.class)
)
)
) &&
isUndef(el.__wxsClass) // fixed by xxxxxx __wxsClass
) {
return
}
Expand All @@ -6805,6 +6808,11 @@ function updateClass (oldVnode, vnode) {
cls = concat(cls, stringifyClass(transitionClass));
}

// fixed by xxxxxx __wxsClass
if(el.__wxsClass){
cls = concat(cls, el.__wxsClass);
}

// set the class
if (cls !== el._prevClass) {
el.setAttribute('class', cls);
Expand Down Expand Up @@ -7826,15 +7834,16 @@ var normalize = cached(function (prop) {
function updateStyle (oldVnode, vnode) {
var data = vnode.data;
var oldData = oldVnode.data;

var el = vnode.elm;
if (isUndef(data.staticStyle) && isUndef(data.style) &&
isUndef(oldData.staticStyle) && isUndef(oldData.style)
isUndef(oldData.staticStyle) && isUndef(oldData.style) &&
isUndef(el.__wxsStyle) // fixed by xxxxxx __wxsStyle
) {
return
}

var cur, name;
var el = vnode.elm;

var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};

Expand All @@ -7852,6 +7861,12 @@ function updateStyle (oldVnode, vnode) {

var newStyle = getStyle(vnode, true);

// fixed by xxxxxx __wxsStyle
if(el.__wxsStyle){
Object.assign(vnode.data.normalizedStyle, el.__wxsStyle);
Object.assign(newStyle, el.__wxsStyle);
}

for (name in oldStyle) {
if (isUndef(newStyle[name])) {
setProp(el, name, '');
Expand Down Expand Up @@ -9753,6 +9768,7 @@ function parse (
shouldKeepComment: options.comments,
outputSourceRange: options.outputSourceRange,
start: function start (tag, attrs, unary, start$1, end) {

// check namespace.
// inherit parent ns if there is one
var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,9 @@ class Observer {
def(value, '__ob__', this);
if (Array.isArray(value)) {
if (hasProto) {
protoAugment(value, arrayMethods);
{
protoAugment(value, arrayMethods);
}
} else {
copyAugment(value, arrayMethods, arrayKeys);
}
Expand Down Expand Up @@ -6820,7 +6822,8 @@ function updateClass (oldVnode, vnode) {
isUndef(oldData.staticClass) &&
isUndef(oldData.class)
)
)
) &&
isUndef(el.__wxsClass) // fixed by xxxxxx __wxsClass
) {
return
}
Expand All @@ -6833,6 +6836,11 @@ function updateClass (oldVnode, vnode) {
cls = concat(cls, stringifyClass(transitionClass));
}

// fixed by xxxxxx __wxsClass
if(el.__wxsClass){
cls = concat(cls, el.__wxsClass);
}

// set the class
if (cls !== el._prevClass) {
el.setAttribute('class', cls);
Expand Down Expand Up @@ -7849,15 +7857,16 @@ const normalize = cached(function (prop) {
function updateStyle (oldVnode, vnode) {
const data = vnode.data;
const oldData = oldVnode.data;

const el = vnode.elm;
if (isUndef(data.staticStyle) && isUndef(data.style) &&
isUndef(oldData.staticStyle) && isUndef(oldData.style)
isUndef(oldData.staticStyle) && isUndef(oldData.style) &&
isUndef(el.__wxsStyle) // fixed by xxxxxx __wxsStyle
) {
return
}

let cur, name;
const el = vnode.elm;

const oldStaticStyle = oldData.staticStyle;
const oldStyleBinding = oldData.normalizedStyle || oldData.style || {};

Expand All @@ -7875,6 +7884,12 @@ function updateStyle (oldVnode, vnode) {

const newStyle = getStyle(vnode, true);

// fixed by xxxxxx __wxsStyle
if(el.__wxsStyle){
Object.assign(vnode.data.normalizedStyle, el.__wxsStyle);
Object.assign(newStyle, el.__wxsStyle);
}

for (name in oldStyle) {
if (isUndef(newStyle[name])) {
setProp(el, name, '');
Expand Down Expand Up @@ -9770,6 +9785,7 @@ function parse (
shouldKeepComment: options.comments,
outputSourceRange: options.outputSourceRange,
start (tag, attrs, unary, start, end) {

// check namespace.
// inherit parent ns if there is one
const ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
Expand Down

Large diffs are not rendered by default.

26 changes: 21 additions & 5 deletions packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,9 @@ var Observer = function Observer (value) {
def(value, '__ob__', this);
if (Array.isArray(value)) {
if (hasProto) {
protoAugment(value, arrayMethods);
{
protoAugment(value, arrayMethods);
}
} else {
copyAugment(value, arrayMethods, arrayKeys);
}
Expand Down Expand Up @@ -6814,7 +6816,8 @@ function updateClass (oldVnode, vnode) {
isUndef(oldData.staticClass) &&
isUndef(oldData.class)
)
)
) &&
isUndef(el.__wxsClass) // fixed by xxxxxx __wxsClass
) {
return
}
Expand All @@ -6827,6 +6830,11 @@ function updateClass (oldVnode, vnode) {
cls = concat(cls, stringifyClass(transitionClass));
}

// fixed by xxxxxx __wxsClass
if(el.__wxsClass){
cls = concat(cls, el.__wxsClass);
}

// set the class
if (cls !== el._prevClass) {
el.setAttribute('class', cls);
Expand Down Expand Up @@ -7848,15 +7856,16 @@ var normalize = cached(function (prop) {
function updateStyle (oldVnode, vnode) {
var data = vnode.data;
var oldData = oldVnode.data;

var el = vnode.elm;
if (isUndef(data.staticStyle) && isUndef(data.style) &&
isUndef(oldData.staticStyle) && isUndef(oldData.style)
isUndef(oldData.staticStyle) && isUndef(oldData.style) &&
isUndef(el.__wxsStyle) // fixed by xxxxxx __wxsStyle
) {
return
}

var cur, name;
var el = vnode.elm;

var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};

Expand All @@ -7874,6 +7883,12 @@ function updateStyle (oldVnode, vnode) {

var newStyle = getStyle(vnode, true);

// fixed by xxxxxx __wxsStyle
if(el.__wxsStyle){
Object.assign(vnode.data.normalizedStyle, el.__wxsStyle);
Object.assign(newStyle, el.__wxsStyle);
}

for (name in oldStyle) {
if (isUndef(newStyle[name])) {
setProp(el, name, '');
Expand Down Expand Up @@ -9782,6 +9797,7 @@ function parse (
shouldKeepComment: options.comments,
outputSourceRange: options.outputSourceRange,
start: function start (tag, attrs, unary, start$1, end) {

// check namespace.
// inherit parent ns if there is one
var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
Expand Down
26 changes: 21 additions & 5 deletions packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,9 @@
def(value, '__ob__', this);
if (Array.isArray(value)) {
if (hasProto) {
protoAugment(value, arrayMethods);
{
protoAugment(value, arrayMethods);
}
} else {
copyAugment(value, arrayMethods, arrayKeys);
}
Expand Down Expand Up @@ -6796,7 +6798,8 @@
isUndef(oldData.staticClass) &&
isUndef(oldData.class)
)
)
) &&
isUndef(el.__wxsClass) // fixed by xxxxxx __wxsClass
) {
return
}
Expand All @@ -6809,6 +6812,11 @@
cls = concat(cls, stringifyClass(transitionClass));
}

// fixed by xxxxxx __wxsClass
if(el.__wxsClass){
cls = concat(cls, el.__wxsClass);
}

// set the class
if (cls !== el._prevClass) {
el.setAttribute('class', cls);
Expand Down Expand Up @@ -7830,15 +7838,16 @@
function updateStyle (oldVnode, vnode) {
var data = vnode.data;
var oldData = oldVnode.data;

var el = vnode.elm;
if (isUndef(data.staticStyle) && isUndef(data.style) &&
isUndef(oldData.staticStyle) && isUndef(oldData.style)
isUndef(oldData.staticStyle) && isUndef(oldData.style) &&
isUndef(el.__wxsStyle) // fixed by xxxxxx __wxsStyle
) {
return
}

var cur, name;
var el = vnode.elm;

var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};

Expand All @@ -7856,6 +7865,12 @@

var newStyle = getStyle(vnode, true);

// fixed by xxxxxx __wxsStyle
if(el.__wxsStyle){
Object.assign(vnode.data.normalizedStyle, el.__wxsStyle);
Object.assign(newStyle, el.__wxsStyle);
}

for (name in oldStyle) {
if (isUndef(newStyle[name])) {
setProp(el, name, '');
Expand Down Expand Up @@ -9757,6 +9772,7 @@
shouldKeepComment: options.comments,
outputSourceRange: options.outputSourceRange,
start: function start (tag, attrs, unary, start$1, end) {

// check namespace.
// inherit parent ns if there is one
var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,9 @@ var Observer = function Observer (value) {
def(value, '__ob__', this);
if (Array.isArray(value)) {
if (hasProto) {
protoAugment(value, arrayMethods);
{
protoAugment(value, arrayMethods);
}
} else {
copyAugment(value, arrayMethods, arrayKeys);
}
Expand Down Expand Up @@ -6781,7 +6783,8 @@ function updateClass (oldVnode, vnode) {
isUndef(oldData.staticClass) &&
isUndef(oldData.class)
)
)
) &&
isUndef(el.__wxsClass) // fixed by xxxxxx __wxsClass
) {
return
}
Expand All @@ -6794,6 +6797,11 @@ function updateClass (oldVnode, vnode) {
cls = concat(cls, stringifyClass(transitionClass));
}

// fixed by xxxxxx __wxsClass
if(el.__wxsClass){
cls = concat(cls, el.__wxsClass);
}

// set the class
if (cls !== el._prevClass) {
el.setAttribute('class', cls);
Expand Down Expand Up @@ -7178,15 +7186,16 @@ var normalize = cached(function (prop) {
function updateStyle (oldVnode, vnode) {
var data = vnode.data;
var oldData = oldVnode.data;

var el = vnode.elm;
if (isUndef(data.staticStyle) && isUndef(data.style) &&
isUndef(oldData.staticStyle) && isUndef(oldData.style)
isUndef(oldData.staticStyle) && isUndef(oldData.style) &&
isUndef(el.__wxsStyle) // fixed by xxxxxx __wxsStyle
) {
return
}

var cur, name;
var el = vnode.elm;

var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};

Expand All @@ -7204,6 +7213,12 @@ function updateStyle (oldVnode, vnode) {

var newStyle = getStyle(vnode, true);

// fixed by xxxxxx __wxsStyle
if(el.__wxsStyle){
Object.assign(vnode.data.normalizedStyle, el.__wxsStyle);
Object.assign(newStyle, el.__wxsStyle);
}

for (name in oldStyle) {
if (isUndef(newStyle[name])) {
setProp(el, name, '');
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 7aeb8cc

Please sign in to comment.