node.js - 未找到模块:错误:无法解析 'D:\laravel projects\codeGram\resources\js\components' 中的 '../../../vue-temp/vue-editor-bridge'
问题描述
我正在使用 laravel + vuejs 来执行 instagram clone 的关注和取消关注按钮,但是我得到了这个错误我做了我能做的一切,检查了 config.js,删除了模块包并再次运行 npm install 但它在这里不起作用是我的代码
<template>
<div>
<button class="btn btn-primary ml-4" @click="followUser" v-text="buttonText">Folloq</button>
</div>
</template>
<script>
import func from '../../../vue-temp/vue-editor-bridge';
export default {
props: ['userId', 'follows'],
watch: {
status: function() {
this.buttonText = (this.status) ? 'Unfollow' : 'Follow';
}
},
data: function () {
return {
status: this.follows,
buttonText: this.follows ? 'Unfollow' : 'Follow'
}
},
methods: {
followUser() {
axios.post('/follow/' + this.userId)
.then(response => {
this.status = ! this.status;
console.log(response.data);
})
.catch(errors => {
if (errors.response.status == 401){
window.location = '/login';
}
});
}
},
}
</script>
我在 index.blade.php 视图中按钮的代码是
<follow-button user-id="{{$user->id}}" follows="{{ $follows }}"></follow-button>
路线为 Route::post('follow/{user}','App\Http\Controllers\FollowsController@store');
完全错误
./resources/js/components/FollowButton.vue?vue&type=script&lang=js& 中的错误 (./node_modules/babel-loader/lib/index.js??clonedRuleSet-5[0].rules[0].use[0 ]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/js/components/FollowButton.vue?vue&type=script&lang=js&) 7:0-55 找不到模块:错误:无法解析 'D:\laravel projects\codeGram\resources\js\components' 中的 '../../../vue-temp/vue-editor-bridge'
解决方案
我假设您根本不想使用它:
import func from '../../../vue-temp/vue-editor-bridge';
当您想在编写函数时自动完成时,Vscode 从模块中导入这个“函数”。这很烦人,如果有人知道如何将其关闭,您将成为我的个人英雄!
推荐阅读
- angularjs - AngularJS - ng-repeat 多维数组
- bash - 根据另一列的内容在 CSV 中创建一个新列
- angular - Angular Material 6 - 如何以编程方式设置 mat-paginator 偏移量?
- hazelcast - Hazelcast:如何获得近缓存的地图条目命中计数?
- c# - Linq 没有加载整个对象
- ruby-on-rails - 查找数据库中前十位最高的数字
- azure - 向 100 万最终用户应用程序发送字符串的最佳 azure 服务 - 事件网格仍处于预览状态?
- arrays - LSTM Keras ValueError: setting an array element with a sequence.and Expected to see 1 array(s)
- websocket - 如何对 Spring WebSocketStompClient 进行单元测试
- javascript - 在 Javascript 端工作时的 RSA 或其他信息加密方法