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

fix(v3): add transformUrl

上级 35963d01
/*!
* Vue.js v2.6.11
* (c) 2014-2019 Evan You
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
'use strict';
......@@ -7943,7 +7943,22 @@ var transformUnit = function (val) {
return val
};
var setProp = function (el, name, val) {
var urlRE = /url\(\s*'?"?([a-zA-Z0-9\.\-\_\/]+\.(jpg|gif|png))"?'?\s*\)/;
var transformUrl = function (val, ctx) {
if (typeof val === 'string' && val.indexOf('url(') !== -1) {
var matches = val.match(urlRE);
if (matches && matches.length === 3) {
val = val.replace(matches[1], ctx._$getRealPath(matches[1]));
}
}
return val
};
var setProp = function (el, name, val, ctx) {
if(ctx && ctx._$getRealPath && val){
val = transformUrl(val, ctx);
}
/* istanbul ignore if */
if (cssVarRE.test(name)) {
el.style.setProperty(name, val);
......@@ -7994,7 +8009,7 @@ function updateStyle (oldVnode, vnode) {
}
var cur, name;
var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
......@@ -8027,7 +8042,7 @@ function updateStyle (oldVnode, vnode) {
cur = newStyle[name];
if (cur !== oldStyle[name]) {
// ie9 setting to null has no effect, must use empty string
setProp(el, name, cur == null ? '' : cur);
setProp(el, name, cur == null ? '' : cur, vnode.context);
}
}
}
......
/*!
* Vue.js v2.6.11
* (c) 2014-2019 Evan You
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
/* */
......@@ -7968,7 +7968,22 @@ const transformUnit = (val) => {
return val
};
const setProp = (el, name, val) => {
const urlRE = /url\(\s*'?"?([a-zA-Z0-9\.\-\_\/]+\.(jpg|gif|png))"?'?\s*\)/;
const transformUrl = (val, ctx) => {
if (typeof val === 'string' && val.indexOf('url(') !== -1) {
const matches = val.match(urlRE);
if (matches && matches.length === 3) {
val = val.replace(matches[1], ctx._$getRealPath(matches[1]));
}
}
return val
};
const setProp = (el, name, val, ctx) => {
if(ctx && ctx._$getRealPath && val){
val = transformUrl(val, ctx);
}
/* istanbul ignore if */
if (cssVarRE.test(name)) {
el.style.setProperty(name, val);
......@@ -8019,7 +8034,7 @@ function updateStyle (oldVnode, vnode) {
}
let cur, name;
const oldStaticStyle = oldData.staticStyle;
const oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
......@@ -8052,7 +8067,7 @@ function updateStyle (oldVnode, vnode) {
cur = newStyle[name];
if (cur !== oldStyle[name]) {
// ie9 setting to null has no effect, must use empty string
setProp(el, name, cur == null ? '' : cur);
setProp(el, name, cur == null ? '' : cur, vnode.context);
}
}
}
......
/*!
* Vue.js v2.6.11
* (c) 2014-2019 Evan You
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
/* */
......@@ -7965,7 +7965,22 @@ var transformUnit = function (val) {
return val
};
var setProp = function (el, name, val) {
var urlRE = /url\(\s*'?"?([a-zA-Z0-9\.\-\_\/]+\.(jpg|gif|png))"?'?\s*\)/;
var transformUrl = function (val, ctx) {
if (typeof val === 'string' && val.indexOf('url(') !== -1) {
var matches = val.match(urlRE);
if (matches && matches.length === 3) {
val = val.replace(matches[1], ctx._$getRealPath(matches[1]));
}
}
return val
};
var setProp = function (el, name, val, ctx) {
if(ctx && ctx._$getRealPath && val){
val = transformUrl(val, ctx);
}
/* istanbul ignore if */
if (cssVarRE.test(name)) {
el.style.setProperty(name, val);
......@@ -8016,7 +8031,7 @@ function updateStyle (oldVnode, vnode) {
}
var cur, name;
var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
......@@ -8049,7 +8064,7 @@ function updateStyle (oldVnode, vnode) {
cur = newStyle[name];
if (cur !== oldStyle[name]) {
// ie9 setting to null has no effect, must use empty string
setProp(el, name, cur == null ? '' : cur);
setProp(el, name, cur == null ? '' : cur, vnode.context);
}
}
}
......
/*!
* Vue.js v2.6.11
* (c) 2014-2019 Evan You
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
(function (global, factory) {
......@@ -7947,7 +7947,22 @@
return val
};
var setProp = function (el, name, val) {
var urlRE = /url\(\s*'?"?([a-zA-Z0-9\.\-\_\/]+\.(jpg|gif|png))"?'?\s*\)/;
var transformUrl = function (val, ctx) {
if (typeof val === 'string' && val.indexOf('url(') !== -1) {
var matches = val.match(urlRE);
if (matches && matches.length === 3) {
val = val.replace(matches[1], ctx._$getRealPath(matches[1]));
}
}
return val
};
var setProp = function (el, name, val, ctx) {
if(ctx && ctx._$getRealPath && val){
val = transformUrl(val, ctx);
}
/* istanbul ignore if */
if (cssVarRE.test(name)) {
el.style.setProperty(name, val);
......@@ -7998,7 +8013,7 @@
}
var cur, name;
var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
......@@ -8031,7 +8046,7 @@
cur = newStyle[name];
if (cur !== oldStyle[name]) {
// ie9 setting to null has no effect, must use empty string
setProp(el, name, cur == null ? '' : cur);
setProp(el, name, cur == null ? '' : cur, vnode.context);
}
}
}
......
/*!
* Vue.js v2.6.11
* (c) 2014-2019 Evan You
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
'use strict';
......@@ -7295,7 +7295,22 @@ var transformUnit = function (val) {
return val
};
var setProp = function (el, name, val) {
var urlRE = /url\(\s*'?"?([a-zA-Z0-9\.\-\_\/]+\.(jpg|gif|png))"?'?\s*\)/;
var transformUrl = function (val, ctx) {
if (typeof val === 'string' && val.indexOf('url(') !== -1) {
var matches = val.match(urlRE);
if (matches && matches.length === 3) {
val = val.replace(matches[1], ctx._$getRealPath(matches[1]));
}
}
return val
};
var setProp = function (el, name, val, ctx) {
if(ctx && ctx._$getRealPath && val){
val = transformUrl(val, ctx);
}
/* istanbul ignore if */
if (cssVarRE.test(name)) {
el.style.setProperty(name, val);
......@@ -7346,7 +7361,7 @@ function updateStyle (oldVnode, vnode) {
}
var cur, name;
var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
......@@ -7379,7 +7394,7 @@ function updateStyle (oldVnode, vnode) {
cur = newStyle[name];
if (cur !== oldStyle[name]) {
// ie9 setting to null has no effect, must use empty string
setProp(el, name, cur == null ? '' : cur);
setProp(el, name, cur == null ? '' : cur, vnode.context);
}
}
}
......
/*!
* Vue.js v2.6.11
* (c) 2014-2019 Evan You
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
/* */
......@@ -7317,7 +7317,22 @@ var transformUnit = function (val) {
return val
};
var setProp = function (el, name, val) {
var urlRE = /url\(\s*'?"?([a-zA-Z0-9\.\-\_\/]+\.(jpg|gif|png))"?'?\s*\)/;
var transformUrl = function (val, ctx) {
if (typeof val === 'string' && val.indexOf('url(') !== -1) {
var matches = val.match(urlRE);
if (matches && matches.length === 3) {
val = val.replace(matches[1], ctx._$getRealPath(matches[1]));
}
}
return val
};
var setProp = function (el, name, val, ctx) {
if(ctx && ctx._$getRealPath && val){
val = transformUrl(val, ctx);
}
/* istanbul ignore if */
if (cssVarRE.test(name)) {
el.style.setProperty(name, val);
......@@ -7368,7 +7383,7 @@ function updateStyle (oldVnode, vnode) {
}
var cur, name;
var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
......@@ -7401,7 +7416,7 @@ function updateStyle (oldVnode, vnode) {
cur = newStyle[name];
if (cur !== oldStyle[name]) {
// ie9 setting to null has no effect, must use empty string
setProp(el, name, cur == null ? '' : cur);
setProp(el, name, cur == null ? '' : cur, vnode.context);
}
}
}
......
/*!
* Vue.js v2.6.11
* (c) 2014-2019 Evan You
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
(function (global, factory) {
......@@ -7299,7 +7299,22 @@
return val
};
var setProp = function (el, name, val) {
var urlRE = /url\(\s*'?"?([a-zA-Z0-9\.\-\_\/]+\.(jpg|gif|png))"?'?\s*\)/;
var transformUrl = function (val, ctx) {
if (typeof val === 'string' && val.indexOf('url(') !== -1) {
var matches = val.match(urlRE);
if (matches && matches.length === 3) {
val = val.replace(matches[1], ctx._$getRealPath(matches[1]));
}
}
return val
};
var setProp = function (el, name, val, ctx) {
if(ctx && ctx._$getRealPath && val){
val = transformUrl(val, ctx);
}
/* istanbul ignore if */
if (cssVarRE.test(name)) {
el.style.setProperty(name, val);
......@@ -7350,7 +7365,7 @@
}
var cur, name;
var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
......@@ -7383,7 +7398,7 @@
cur = newStyle[name];
if (cur !== oldStyle[name]) {
// ie9 setting to null has no effect, must use empty string
setProp(el, name, cur == null ? '' : cur);
setProp(el, name, cur == null ? '' : cur, vnode.context);
}
}
}
......
......@@ -2,6 +2,8 @@ import initVue from 'uni-core/vue'
import ViewPlugin from 'uni-core/view/plugins/index'
import getRealPath from 'uni-platform/helpers/get-real-path'
import {
initData
} from './data'
......@@ -11,12 +13,14 @@ import {
} from './event'
export default {
install (Vue, options) {
if (process.env.NODE_ENV !== 'production') {
install (Vue, options) {
if (process.env.NODE_ENV !== 'production') {
Vue.config.productionTip = false
Vue.config.performance = true
}
Vue.prototype._$getRealPath = getRealPath
initVue(Vue)
ViewPlugin.install(Vue, options)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册