-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from mpvue/feature/smartprograme
百度小程序支持和代码重构
- Loading branch information
Showing
6 changed files
with
103 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
function genPageWxml (templateName, src) { | ||
function genWXML (templateName, src) { | ||
return `<import src="${src}" /><template is="${templateName}" data="{{ ...$root['0'], $root }}"/>` | ||
} | ||
|
||
module.exports = { genPageWxml } | ||
function genSWANML (templateName, src) { | ||
return `<import src="${src}" /><template is="${templateName}" data="{{{ ...$root['0'], $root }}}"/>` | ||
} | ||
|
||
function genPageML (templateName, src, fileExt = {}) { | ||
let code | ||
switch (fileExt.platform) { | ||
case 'swan': | ||
code = genSWANML(templateName, src) | ||
break | ||
case 'wx': | ||
code = genWXML(templateName, src) | ||
break | ||
default: | ||
code = genWXML(templateName, src) | ||
} | ||
return code | ||
} | ||
|
||
module.exports = { genPageML } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters