Skip to content

Commit

Permalink
Merge pull request #52 from mpvue/feature/ttalipay
Browse files Browse the repository at this point in the history
Feature/ttalipay
  • Loading branch information
hucq authored Feb 13, 2019
2 parents 30c4b99 + 1665190 commit 17f1c9c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/mp-compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const {

function genComponentMPML (compiled, options, emitFile, emitError, emitWarning, fileExt) {
options.components['slots'] = { src: '/components/slots', name: 'slots' }
const { code: mpmlContent, compiled: compiledResult, slots, importCode } = compiler.compileToWxml(compiled, options, fileExt)
const { code: mpmlContent, compiled: compiledResult, slots, importCode } = compiler.compileToMPML(compiled, options, fileExt)
const { mpErrors, mpTips } = compiledResult
// 缓存 slots,延迟编译
cacheSlots(slots, importCode)
Expand Down
14 changes: 14 additions & 0 deletions lib/mp-compiler/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ function genSWANML (templateName, src) {
return `<import src="${src}" /><template is="${templateName}" data="{{{ ...$root['0'], $root }}}"/>`
}

function genTTML (templateName, src) {
return `<import src="${src}" /><template is="${templateName}" data="{{ ...$root['0'], $root }}"/>`
}

function genMYML (templateName, src) {
return `<import src="${src}" /><template is="${templateName}" data="{{ ...$root['0'], $root }}"/>`
}

function genPageML (templateName, src, fileExt = {}) {
let code
switch (fileExt.platform) {
Expand All @@ -15,6 +23,12 @@ function genPageML (templateName, src, fileExt = {}) {
case 'wx':
code = genWXML(templateName, src)
break
case 'tt':
code = genTTML(templateName, src)
break
case 'my':
code = genMYML(templateName, src)
break
default:
code = genWXML(templateName, src)
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mpvue-loader",
"version": "1.2.2",
"version": "2.0.0",
"description": "mpvue single-file component loader for Webpack",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit 17f1c9c

Please sign in to comment.