The vue loop could not find the el element

problem description

[Vue warn]: option "el" can only be used during instance creation with the `new` keyword. vue.esm.js:592:7
[Vue warn]: Cannot find element: -sharpactionMovieFor

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

export default {
        el:"-sharpactionMovieFor",
        data() {
            return {
                ftpIP: this.GLOBAL.ftpIP,
                server: this.GLOBAL.server,
                actionMovieTmps: {},
                artMovieTmps: {},
                funnyMovieTmps: {},
                ThrillerMovieTmps: {},
            }
        },........

<template>
    <div class="containerBody">
        <div class="panel panel-info moviepanel">
            <div class="panel-body" style="width: 100%; padding-top: 5px;">
                <div id="actionMovie" class="col-md-12 movie_container">
                    <div id="actionMovieFor">
                        <div v-for="(movie,index) in actionMovieTmps" :meta="movie" :key="index" v-on:click="getVideos(movie.id)" style="float:left;width:35%;height:75%;">
                            <p style="cursor: pointer;height:18;width:115px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{movie.title}}

<p style="height:18;width:70%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="movie.description">{{movie.description}}

</div> </div> </div> </div> </div>

what result do you expect? What is the error message actually seen?

iterate through the data asynchronously and display it on the page

Apr.21,2021

el is a parameter used when mounting manually (when new a Vue instance). It means that the current component is mounted to this dom element. Why do you add el here


The

template tag content is inherently invisible and the display:none; property is set. Therefore, if you want to get the ele element in template, you must not get it;

<template>
    <div id="cbox">11111111111</div>
</template>

<script>
    console.log( document.getElementById('cbox')) //null
</script>

in fact, you don't need to set el, for js because this file is already in the form of a component in vue.

Menu