Vue 中是否有可能以与此类似的方式处理一个函数内的传入事件?
<template>
<component v-on="eventsDistributor(eventName, $event)"/>
</template>
<script>
export default {
props: {
handlers: Object,
},
methods : {
eventsDistributor (name, $event) {
let handler = this.handlers[name]
if (handler) return handler($event)
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud) 我尝试使用导入的对象为 .eslintrc.js 文件内的全局变量设置一些限制,但导入不起作用。我如何进行动态 eslint 配置?
import {loadedGlobals} from '@/util/globals'
module.exports = {
'globals': Object.keys(loadedGlobals).reduce((acum, key) => {
acum[key] = false
return acum
}, acum),
// ...
}
Run Code Online (Sandbox Code Playgroud)