node.js - 找不到模块 : Error: Can't resolve '../../../vue-temp/vue-editor-bridge' in 'D:\laravel projects\codeGram\resources\js\components'

标签 node.js laravel vue.js

我正在使用 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 View 中按钮的代码是
 <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 从模块中导入此“函数”。这很烦人,如果有人知道如何将其关闭,您将成为我的个人英雄!

关于node.js - 找不到模块 : Error: Can't resolve '../../../vue-temp/vue-editor-bridge' in 'D:\laravel projects\codeGram\resources\js\components' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65876196/

相关文章:

node.js - 从标准输入读取时无法使用 CTRL D 触发 'end' 事件

node.js - npm 在 Ubuntu 16.04 上删除了 Plesk 12

Laravel : using model factories to generate one-to-many relationships

php - 如何在 Laravel 中通过 join 将一对多关系分组

php - Laravel mysql json 数据选择

css - 如何在 Vuetify 或 Material Design 中进行这样的居中布局?

javascript - 如何将类绑定(bind)到 Vue.js 中的两个以上选项?

node.js - 找不到 NPM 命令

javascript - Node.js EventEmitter 和多级继承

vue.js - 是否可以将 'label-position: top' 仅应用于 Element UI 中的一个表单项