From dc84cd5cbe384f9a9d798cda5010b72093fdd244 Mon Sep 17 00:00:00 2001 From: wkj <278599135@qq.com> Date: Wed, 1 Jun 2022 12:06:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84=E7=9A=84?= =?UTF-8?q?=E5=8F=8C=E6=96=9C=E7=BA=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/loaders/wxml-loader.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/config/loaders/wxml-loader.js b/config/loaders/wxml-loader.js index 29869a7..715d339 100644 --- a/config/loaders/wxml-loader.js +++ b/config/loaders/wxml-loader.js @@ -126,7 +126,10 @@ module.exports = async function (content) { const isSelf = context.indexOf(projectContext) !== -1; if (isSelf) { //本项目xml - relativePath = relative(context, projectContext + '/' + WXS_PATH); + relativePath = relative( + context, + projectContext + '/' + WXS_PATH + ).replace(/\\/g, '/'); } else { //第三方项目的xml const index = context.lastIndexOf(WeChatMpDir); @@ -135,7 +138,7 @@ module.exports = async function (content) { relativePath = relative( projectContext + p, projectContext + '/' + WXS_PATH - ); + ).replace(/\\/g, '/'); } } @@ -147,7 +150,7 @@ module.exports = async function (content) { if (/pages/.test(context)) { source = source + - ''; + ``; } // console.log(content, options); @@ -189,7 +192,7 @@ module.exports = async function (content) { if (node.hasAttribute('oak:value')) { const oakValue = node.getAttribute('oak:value'); node.removeAttribute('oak:value'); - node.setAttribute('value', `{{${oakValue}}}`); + node.setAttribute('value', `{{${oakValue} !== undefined ? ${oakValue} : ''}}`); node.setAttribute('data-attr', oakValue); node.setAttribute('oakPath', oakValue); // node.setAttribute('oakValue', `{{${oakValue}}}`);