Unknown language: "vue" at _highlight (core.js:2116:1)
时间: 2024-05-29 21:15:58 浏览: 8
"Vue" is a progressive JavaScript framework used for building user interfaces. It is often used for building single-page applications and is known for its simplicity and flexibility. Vue allows developers to create reusable components, and it offers a reactive and declarative way of building UIs.
相关问题
vue.esm.js:5105 [Vue warn]: data functions should return an object: https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function found in ---> <ShouYe> at src/components/ShouYe.vue <App> at src/App.vue <Root> warn$2 @ vue.esm.js:5105 initData @ vue.esm.js:4385 initState @ vue.esm.js:4322 Vue._init @ vue.esm.js:4711 VueComponent @ vue.esm.js:5836 createComponentInstanceForVnode @ vue.esm.js:5044 init @ vue.esm.js:4906 merged @ vue.esm.js:5061 createComponent @ vue.esm.js:6578 createElm @ vue.esm.js:6532 createChildren @ vue.esm.js:6651 createElm @ vue.esm.js:6555 patch @ vue.esm.js:7082 Vue._update @ vue.esm.js:2870 updateComponent @ vue.esm.js:2980 Watcher.get @ vue.esm.js:4164 Watcher @ vue.esm.js:4154 mountComponent @ vue.esm.js:2997 Vue.$mount @ vue.esm.js:9312 Vue.$mount @ vue.esm.js:11877 init @ vue.esm.js:4907 createComponent @ vue.esm.js:6578 createElm @ vue.esm.js:6532 patch @ vue.esm.js:7120 Vue._update @ vue.esm.js:2870 updateComponent @ vue.esm.js:2980 Watcher.get @ vue.esm.js:4164 Watcher @ vue.esm.js:4154 mountComponent @ vue.esm.js:2997 Vue.$mount @ vue.esm.js:9312 Vue.$mount @ vue.esm.js:11877 Vue._init @ vue.esm.js:4721 Vue @ vue.esm.js:5772 eval @ main.js:14 ./src/main.js @ app.js:2520 __webpack_require__ @ app.js:679 fn @ app.js:89 0 @ app.js:2537 __webpack_require__ @ app.js:679 (anonymous) @ app.js:725 (anonymous) @ app.js:728
这个警告表示,在定义 Vue 组件时,data 选项应该是一个函数而不是一个对象。Vue 的官方文档说明,每个组件的 data 必须是一个函数,返回一个对象,而不是一个对象本身。这是为了确保每个组件实例都有一个独立的数据对象,而不是共享同一个数据对象。
解决方法是将 data 选项改成一个函数,例如:
```javascript
export default {
name: 'ShouYe',
data() {
return {
// your data properties
}
}
}
```
这样就能避免这个警告了。
xhr.js:251 GET http://localhost:9090/api/images/lol/act/img/js/heroList/hero_list.js 404 (Not Found) dispatchXhrRequest @ xhr.js:251 xhr @ xhr.js:49 dispatchRequest @ dispatchRequest.js:51 request @ Axios.js:148 Axios.<computed> @ Axios.js:174 wrap @ bind.js:5 created @ App.vue:23 invokeWithErrorHandling @ vue.runtime.esm.js:3017 callHook$1 @ vue.runtime.esm.js:4031 Vue._init @ vue.runtime.esm.js:5693 VueComponent @ vue.runtime.esm.js:5826 createComponentInstanceForVnode @ vue.runtime.esm.js:4544 init @ vue.runtime.esm.js:4406 createComponent @ vue.runtime.esm.js:6567 createElm @ vue.runtime.esm.js:6521 patch @ vue.runtime.esm.js:7109 Vue._update @ vue.runtime.esm.js:3765 updateComponent @ vue.runtime.esm.js:3875 Watcher.get @ vue.runtime.esm.js:3446 Watcher @ vue.runtime.esm.js:3436 mountComponent @ vue.runtime.esm.js:3892 Vue.$mount @ vue.runtime.esm.js:8772 eval @ main.js:8 ./src/main.js @ app.js:219 __webpack_require__ @ app.js:280 (匿名) @ app.js:1402 __webpack_require__.O @ app.js:326 (匿名) @ app.js:1403 (匿名) @ app.js:1405 App.vue:28 AxiosError {message: 'Request failed with status code 404', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}
根据错误信息,可以看出请求的地址"http://localhost:9090/api/images/lol/act/img/js/heroList/hero_list.js"返回了404错误,即资源未找到。这可能是由于以下几个原因:
1. 代理配置错误:请确保代理配置正确,即将以'/api'开头的请求转发到"https://game.gtimg.cn",并且去掉了'/api'前缀。可以检查一下代理配置是否正确。
2. 请求地址错误:请确认请求地址是否正确,确保请求的资源存在。可以在浏览器中直接访问"http://localhost:9090/api/images/lol/act/img/js/heroList/hero_list.js",看看是否能够正常获取到资源。
3. 跨域问题:如果请求地址和当前域名不同,可能会存在跨域问题。可以尝试在代理配置中添加`changeOrigin: true`选项,启用跨域请求。
请根据以上提示逐一排查问题,如果还有其他问题,请继续提问。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)