是否有 eslint 规则要求开发人员以更简洁的方式声明数组,例如:
坏的:
const array = [
{
name: 'x'
},
{
name: 'y'
}
];
Run Code Online (Sandbox Code Playgroud)
好的:
const array = [{
name: 'x'
}, {
name: 'y'
}];
Run Code Online (Sandbox Code Playgroud) 我有一个组件 v-popup.vue
<template>
<div class="overlay">
<div class="popup">
<slot></slot>
</div>
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
我想从父级设置样式,例如:
<template>
<v-popup class="custom-popup">
Popup content
</v-popup>
</template>
<style>
.custom-popup {
padding: 20px;
}
</style>
Run Code Online (Sandbox Code Playgroud)
如何配置v-popup.vue组件以使custom-popup类自动添加到div.popup,而不是div.overlay?