Daily work Flashcards
Things I need to look up in my daily work
1
Q
In vue 2, if you’re attempting to style a nested component within a child component, what do you need to use?
A
In Vue 2 with scoped styles, you must use the ::v-deep selector to target nested elements within child components
<style>
\::v-deep(.custom-time-picker .v-time-picker-title\_\_time .v-picker\_\_title\_\_btn), \::v-deep(.custom-time-picker .v-time-picker-title\_\_time span) { font-size: 25px !important; height: 25px !important; }</style>
2
Q
How do you destructure an object with one key value pair?
A
const [[key, value]] = Object.entries(obj);
Object.entries(obj) converts the object into an array of [key, value] pairs.
Example: { key: ‘value’ } becomes [[‘key’, ‘value’]].
The destructuring [[key, value]] extracts the first [key, value] pair from the array.