提交 7c47df4a 编写于 作者: Q qiang

feat: 头条小程序 swiper 增加属性 disable-touch

上级 1da86614
......@@ -19,6 +19,7 @@ const generateTemplate = require('./template/generate')
const compilerModule = require('./module')
const compilerAlipayModule = require('./module-alipay')
const compilerToutiaoModule = require('./module-toutiao')
const generateCodeFrame = require('./codeframe')
......@@ -75,6 +76,8 @@ module.exports = {
if (options.mp.platform === 'mp-alipay') {
options.modules.push(compilerAlipayModule)
} else if (options.mp.platform === 'mp-toutiao') {
options.modules.push(compilerToutiaoModule)
}
const res = compileTemplate(source, Object.assign(options, {
......@@ -254,4 +257,4 @@ at ${resourcePath}.vue:1`)
ssrCompile,
ssrCompileToFunctions,
generateCodeFrame
}
}
module.exports = {
postTransformNode (el) {
if (el.tag === 'swiper') {
const attrsMap = el.attrsMap
let touchable
if (attrsMap[':disable-touch']) {
touchable = `!(${attrsMap[':disable-touch']})`
} else if ('disable-touch' in attrsMap) {
touchable = 'false'
}
if (touchable) {
const attr = el.attrs.find(attr => attr.name === ':touchable')
if (attr) {
attr.value = touchable
} else {
el.attrs.push({
name: ':touchable',
value: touchable
})
}
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册