How to reuse HTML combined with Vue code?

Hello, seniors:

I Xiaobai, in the process of developing the test paper module, the test paper editing page has been written, and Vue is used to achieve two-way data binding.

now we need to develop a test paper preview module, how to achieve the reuse of a lot of written code (as follows)?

take a look at how to achieve HTML reuse , the implementation of this post seems to be a static page, I do not know how to achieve Vue data rendering?

I hope to give some advice to my seniors

 <!--  -->
        <div v-for = "(item, index) in questions">
            
            <!--  title -->
            <div>
                <label>{{index + 1}}</label>
                <span>. :</span>
                <select :id = ""questionType"+index" @change = "changeQuestionType(index)" v-model = "item.questionType">
                    <option value = "1"></option>
                    <option value = "2"></option>
                    <option value = "3"></option>
                    <option value = "4"></option>
                    <option value = "5"></option>
                    <option value = "6"></option>
                    <option value = "7"></option>
                    <option value = "8" v-show = "item.parentId == null || item.parentId == -1"></option>
                </select>
                <input v-model="item.score" type="number">
                <span></span>
                <button v-on:click = "saveQuestion(index)">
                    
                </button>
                <button @click = "deleteQuestion(item.questionId)">
                    
                </button>
            </div>

            <!--  -->
            <div :id = ""stem"+index">
            
            </div>
</div>
Mar.03,2021
The component of

vue is reused


can be used as a component. Both editing and preview pages refer to this component, which is judged by passing parameters to determine whether to edit or preview. If it is a preview, disable @ click operations


prop parent
this.emit child pass parent (event and value)
the last two are values
component reuse.

Menu