vscode-vue-peek
vscode-vue-peek copied to clipboard
Allow refactory selected html into new vue component
Create an action Extract Vue Component o Extract Vue Page. Ctrl + Shift + F11
Suggestion When this action would be called, having selected an HTML fragment, create a new vue component, into the components folder, with a temp name for example Component1.vue, then move the selected text into this file. Replace the selected text with to name of the component created.
Example app.vue
<template>
<div class"app">
<h1>That is cool</h1>
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Magni debitis
qui optio fugit quas earum aliquid perferendis sed suscipit odit
perspiciatis totam illo soluta, quis quia sit dolorum facere fugiat!
</p>
</div>
</template>
select tag h1 and tag p will create a new file Component1.vue with selected text
Component1.vue
<template>
<div>
<h1>That is cool</h1>
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Magni debitis
qui optio fugit quas earum aliquid perferendis sed suscipit odit
perspiciatis totam illo soluta, quis quia sit dolorum facere fugiat!
</p>
</div>
</template>
app.vue
<div class"app">
<Component1 />
</div>
</template>
I've come up with this good idea too. Extract selection html into SFC.