Skip to content

Commit

Permalink
fix: eslint error
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackgan3 committed Oct 10, 2023
1 parent f294429 commit dbdf500
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {hasOwn, setByPath} from '@mpxjs/utils'
import { hasOwn, setByPath } from '@mpxjs/utils'
const datasetReg = /^data-(.+)$/

function collectDataset (props) {
Expand Down
12 changes: 5 additions & 7 deletions packages/webpack-plugin/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,12 @@ class MpxWebpackPlugin {
options.asyncSubpackageRules = options.asyncSubpackageRules || null
options.retryRequireAsync = options.retryRequireAsync || false
options.enableAliRequireAsync = options.enableAliRequireAsync || false
if (options.mode) {
let fallthroughEventAttrsRules = []
const fallthroughEventAttrsRulesRaw = options.fallthroughEventAttrsRules
if (fallthroughEventAttrsRulesRaw) {
fallthroughEventAttrsRules = Array.isArray(fallthroughEventAttrsRulesRaw) ? fallthroughEventAttrsRulesRaw : [fallthroughEventAttrsRulesRaw]
}
options.fallthroughEventAttrsRules = fallthroughEventAttrsRules
let fallthroughEventAttrsRules = []
const fallthroughEventAttrsRulesRaw = options.fallthroughEventAttrsRules
if (fallthroughEventAttrsRulesRaw) {
fallthroughEventAttrsRules = Array.isArray(fallthroughEventAttrsRulesRaw) ? fallthroughEventAttrsRulesRaw : [fallthroughEventAttrsRulesRaw]
}
options.fallthroughEventAttrsRules = fallthroughEventAttrsRules
this.options = options
// Hack for buildDependencies
const rawResolveBuildDependencies = FileSystemInfo.prototype.resolveBuildDependencies
Expand Down
22 changes: 11 additions & 11 deletions packages/webpack-plugin/lib/template-compiler/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ function processRootViewEventHack (el, options, root) {
}
const { fallthroughEventAttrsRules } = options
// TODO: 设置可透传的事件可选列表
let fallThroughEvents = []
let fallThroughEvents = null
// 判断当前文件是否在范围中
const filePath = options.filePath
for (const item of fallthroughEventAttrsRules) {
Expand All @@ -1795,18 +1795,18 @@ function processRootViewEventHack (el, options, root) {
exclude
})) {
const eventsRaw = item.events
const events = Array.isArray(eventsRaw) ? eventsRaw : [eventsRaw]
fallThroughEvents = Array.from(new Set(fallThroughEvents.concat(events)))
fallThroughEvents = Array.isArray(eventsRaw) ? eventsRaw : [eventsRaw]
break
}
}

fallThroughEvents.forEach((type) => {
addAttrs(el, [{
name: type,
value: '__proxyEvent'
}])
})
if (fallThroughEvents) {
fallThroughEvents.forEach((type) => {
addAttrs(el, [{
name: type,
value: '__proxyEvent'
}])
})
}
}

function processRootViewStyleClassHack (el, options, root) {
Expand Down Expand Up @@ -2042,7 +2042,7 @@ function processElement (el, root, options, meta) {
const transAli = mode === 'ali' && srcMode === 'wx'
const transWeb = mode === 'web' && srcMode === 'wx'
if (transAli) {
processRootViewStyleClassHack(el, options, rootView)
processRootViewStyleClassHack(el, options, el)
processRootViewEventHack(el, options, el)
}
if (transWeb) {
Expand Down

0 comments on commit dbdf500

Please sign in to comment.