找不到模块:错误:无法解析“D:\laravel projects\codeGram\resources\js\components”中的“../../../vue-temp/vue-editor-bridge”

cod*_*irl 5 node.js laravel vue.js

我正在使用 laravel + vuejs 来执行 instagram 克隆的关注和取消关注按钮,但是我得到了这个错误我的代码

<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>
Run Code Online (Sandbox Code Playgroud)

我在 index.blade.php 视图中的按钮代码是

 <follow-button user-id="{{$user->id}}"  follows="{{ $follows }}"></follow-button>
Run Code Online (Sandbox Code Playgroud)

路由是 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”

Yur*_*ace 14

VS Code 自动添加到您的代码行中,例如:

import func from 'vue-editor-bridge'
Run Code Online (Sandbox Code Playgroud)

在您的代码中找到它并将其删除。完毕!


Sev*_*ugg 10

我假设您根本不想使用它:

import func from '../../../vue-temp/vue-editor-bridge';
Run Code Online (Sandbox Code Playgroud)

当您想在编写函数时自动完成时,Vscode 会从模块中导入这个“函数”。这很烦人,如果有人知道如何将其关闭,您将成为我的个人英雄!