提交 37881269 编写于 作者: fxy060608's avatar fxy060608

fix(mp): wxs

上级 402c2f28
......@@ -1763,6 +1763,36 @@
/* */
/* */
function transformNode(el) {
var list = el.attrsList;
for (var i = list.length - 1; i >= 0; i--) {
var name = list[i].name;
if (name.indexOf(':change:') === 0 || name.indexOf('v-bind:change:') === 0) {
var nameArr = name.split(':');
var wxsProp = nameArr[nameArr.length - 1];
var wxsPropBinding = el.attrsMap[':' + wxsProp] || el.attrsMap['v-bind:' + wxsProp];
if (wxsPropBinding) {
(el.wxsPropBindings || (el.wxsPropBindings = {}))['change:' + wxsProp] = wxsPropBinding;
}
}
}
}
function genData(el) {
var data = '';
if (el.wxsPropBindings) {
data += "wxsProps:" + (JSON.stringify(el.wxsPropBindings)) + ",";
}
return data
}
var wxs = {
transformNode: transformNode,
genData: genData
};
/* */
var validDivisionCharRE = /[\w).+\-_$\]]/;
......@@ -1863,6 +1893,54 @@
/* */
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
var open = delimiters[0].replace(regexEscapeRE, '\\$&');
var close = delimiters[1].replace(regexEscapeRE, '\\$&');
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
});
function parseText (
text,
delimiters
) {
var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
if (!tagRE.test(text)) {
return
}
var tokens = [];
var rawTokens = [];
var lastIndex = tagRE.lastIndex = 0;
var match, index, tokenValue;
while ((match = tagRE.exec(text))) {
index = match.index;
// push text token
if (index > lastIndex) {
rawTokens.push(tokenValue = text.slice(lastIndex, index));
tokens.push(JSON.stringify(tokenValue));
}
// tag token
var exp = parseFilters(match[1].trim());
tokens.push(("_s(" + exp + ")"));
rawTokens.push({ '@binding': exp });
lastIndex = index + match[0].length;
}
if (lastIndex < text.length) {
rawTokens.push(tokenValue = text.slice(lastIndex));
tokens.push(JSON.stringify(tokenValue));
}
return {
expression: tokens.join('+'),
tokens: rawTokens
}
}
/* */
/* eslint-disable no-unused-vars */
......@@ -2090,84 +2168,6 @@
return item
}
/* */
function transformNode(el) {
var list = el.attrsList;
for (var i = list.length - 1; i >= 0; i--) {
var name = list[i].name;
if (name.indexOf(':change:') === 0 || name.indexOf('v-bind:change:') === 0) {
var nameArr = name.split(':');
var wxsProp = nameArr[nameArr.length - 1];
var wxsPropBinding = getBindingAttr(el, wxsProp, false);
if (wxsPropBinding) {
(el.wxsPropBindings || (el.wxsPropBindings = {}))['change:' + wxsProp] = wxsPropBinding;
}
}
}
}
function genData(el) {
var data = '';
if (el.wxsPropBindings) {
data += "wxsProps:" + (JSON.stringify(el.wxsPropBindings)) + ",";
}
return data
}
var wxs = {
transformNode: transformNode,
genData: genData
};
/* */
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
var open = delimiters[0].replace(regexEscapeRE, '\\$&');
var close = delimiters[1].replace(regexEscapeRE, '\\$&');
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
});
function parseText (
text,
delimiters
) {
var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
if (!tagRE.test(text)) {
return
}
var tokens = [];
var rawTokens = [];
var lastIndex = tagRE.lastIndex = 0;
var match, index, tokenValue;
while ((match = tagRE.exec(text))) {
index = match.index;
// push text token
if (index > lastIndex) {
rawTokens.push(tokenValue = text.slice(lastIndex, index));
tokens.push(JSON.stringify(tokenValue));
}
// tag token
var exp = parseFilters(match[1].trim());
tokens.push(("_s(" + exp + ")"));
rawTokens.push({ '@binding': exp });
lastIndex = index + match[0].length;
}
if (lastIndex < text.length) {
rawTokens.push(tokenValue = text.slice(lastIndex));
tokens.push(JSON.stringify(tokenValue));
}
return {
expression: tokens.join('+'),
tokens: rawTokens
}
}
/* */
function transformNode$1 (el, options) {
......
......@@ -1728,6 +1728,36 @@ var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* */
/* */
function transformNode(el) {
var list = el.attrsList;
for (var i = list.length - 1; i >= 0; i--) {
var name = list[i].name;
if (name.indexOf(':change:') === 0 || name.indexOf('v-bind:change:') === 0) {
var nameArr = name.split(':');
var wxsProp = nameArr[nameArr.length - 1];
var wxsPropBinding = el.attrsMap[':' + wxsProp] || el.attrsMap['v-bind:' + wxsProp];
if (wxsPropBinding) {
(el.wxsPropBindings || (el.wxsPropBindings = {}))['change:' + wxsProp] = wxsPropBinding;
}
}
}
}
function genData(el) {
var data = '';
if (el.wxsPropBindings) {
data += "wxsProps:" + (JSON.stringify(el.wxsPropBindings)) + ",";
}
return data
}
var wxs = {
transformNode: transformNode,
genData: genData
};
/* */
var validDivisionCharRE = /[\w).+\-_$\]]/;
......@@ -1828,6 +1858,54 @@ function wrapFilter (exp, filter) {
/* */
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
var open = delimiters[0].replace(regexEscapeRE, '\\$&');
var close = delimiters[1].replace(regexEscapeRE, '\\$&');
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
});
function parseText (
text,
delimiters
) {
var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
if (!tagRE.test(text)) {
return
}
var tokens = [];
var rawTokens = [];
var lastIndex = tagRE.lastIndex = 0;
var match, index, tokenValue;
while ((match = tagRE.exec(text))) {
index = match.index;
// push text token
if (index > lastIndex) {
rawTokens.push(tokenValue = text.slice(lastIndex, index));
tokens.push(JSON.stringify(tokenValue));
}
// tag token
var exp = parseFilters(match[1].trim());
tokens.push(("_s(" + exp + ")"));
rawTokens.push({ '@binding': exp });
lastIndex = index + match[0].length;
}
if (lastIndex < text.length) {
rawTokens.push(tokenValue = text.slice(lastIndex));
tokens.push(JSON.stringify(tokenValue));
}
return {
expression: tokens.join('+'),
tokens: rawTokens
}
}
/* */
/* eslint-disable no-unused-vars */
......@@ -2055,84 +2133,6 @@ function rangeSetItem (
return item
}
/* */
function transformNode(el) {
var list = el.attrsList;
for (var i = list.length - 1; i >= 0; i--) {
var name = list[i].name;
if (name.indexOf(':change:') === 0 || name.indexOf('v-bind:change:') === 0) {
var nameArr = name.split(':');
var wxsProp = nameArr[nameArr.length - 1];
var wxsPropBinding = getBindingAttr(el, wxsProp, false);
if (wxsPropBinding) {
(el.wxsPropBindings || (el.wxsPropBindings = {}))['change:' + wxsProp] = wxsPropBinding;
}
}
}
}
function genData(el) {
var data = '';
if (el.wxsPropBindings) {
data += "wxsProps:" + (JSON.stringify(el.wxsPropBindings)) + ",";
}
return data
}
var wxs = {
transformNode: transformNode,
genData: genData
};
/* */
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
var open = delimiters[0].replace(regexEscapeRE, '\\$&');
var close = delimiters[1].replace(regexEscapeRE, '\\$&');
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
});
function parseText (
text,
delimiters
) {
var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
if (!tagRE.test(text)) {
return
}
var tokens = [];
var rawTokens = [];
var lastIndex = tagRE.lastIndex = 0;
var match, index, tokenValue;
while ((match = tagRE.exec(text))) {
index = match.index;
// push text token
if (index > lastIndex) {
rawTokens.push(tokenValue = text.slice(lastIndex, index));
tokens.push(JSON.stringify(tokenValue));
}
// tag token
var exp = parseFilters(match[1].trim());
tokens.push(("_s(" + exp + ")"));
rawTokens.push({ '@binding': exp });
lastIndex = index + match[0].length;
}
if (lastIndex < text.length) {
rawTokens.push(tokenValue = text.slice(lastIndex));
tokens.push(JSON.stringify(tokenValue));
}
return {
expression: tokens.join('+'),
tokens: rawTokens
}
}
/* */
function transformNode$1 (el, options) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册