简体   繁体   中英

Vue not Defined

I have been struggling this error for a while now. I've tried multiple ways and none of them work. All I am trying to do is to get this simple component working. Someone help please. :)

 <script> const app = new Vue({ el: "#main", data: function(){ return { search: '', customers: [ { id: '1', name: 'Something', }, { id: '2', name: 'Something else', }, { id: '3', name: 'Something random', }, { id: '4', name: 'Something crazy', } ]}; }, computed: { filteredCustomers:function() { var self=this; return this.customers.filter(function(cust){return cust.name.toLowerCase().indexOf(self.search.toLowerCase())>=0;}); //return this.customers; } } }); </script>
 <template> <div id="main"> Search: <input type="text" v-model="search"/> <div v-bind:v-for="customer in filteredCustomers"> <span>{{customer.name}}</span> </div> </div> </template>

You should include the Vue library.
One way of doing so is including using <script> as described in Vue's documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM