fix(render): custom cover background image

This commit is contained in:
qingwei.li 2017-02-24 16:05:19 +08:00 • committed by cinwell.li
commit 8f9bf29ee5

View file

@ -104,10 +104,12 @@ export function renderMixin (proto) {
let path = m[1] let path = m[1]
dom.toggleClass(el, 'add', 'has-mask') dom.toggleClass(el, 'add', 'has-mask')
if (isAbsolutePath(m[1])) { if (!isAbsolutePath(m[1])) {
path = getPath(getBasePath(this.config.basePath), m[1]) path = getPath(getBasePath(this.config.basePath), m[1])
} }
el.style.backgroundImage = `url(${path})` el.style.backgroundImage = `url(${path})`
el.style.backgroundSize = 'cover'
el.style.backgroundPosition = 'center center'
} }
html = html.replace(m[0], '') html = html.replace(m[0], '')
} }