小编Але*_*кий的帖子

我不能在Nuxt.js/vue.js中使用第三方组件

我尝试将这个库用于我的Nuxt项目: 入门

我尝试过如何用docs编写,但在所有变种中都会出现错误:unknown自定义元素: - 你是否正确注册了组件?对于递归组件,请确保提供"名称"选项.我试过的:

<template>
    <div class="div-wrapper">
        <h1>grge</h1>
        <div id="typeahead"><typeahead :data="USstate" placeholder="USA states">
        </typeahead></div>



    </div>
</template>
<style lang="less">
    .div-wrapper {
        background: #f4f4f4;
        padding: 95px 15px 50px 15px;
    }
</style>
<script>
    import Vue from 'vue';
    export default {
        data() {
            return {
                USstate: ['Alabama', 'Alaska', 'Arizona'],
                asyncTemplate: '{{ item.formatted_address }}',
                githubTemplate: '<img width="18px" height="18px" :src="item.avatar_url"> <span>{{item.login}}</span>'
            }
        },
        mounted(){
            var typeahead = require('vue-strap/src/Typeahead');
            Vue.component('typeahead',typeahead);
            new Vue({
                el: 'typeahead'
            })
        },
        methods: {
            googleCallback(items, targetVM) {
                const that = targetVM;
                that.reset() …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js nuxt.js

2
推荐指数
1
解决办法
3934
查看次数

标签 统计

javascript ×1

nuxt.js ×1

vue.js ×1