我尝试将这个库用于我的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) 完全菜鸟,需要帮助。
系统:Win 10。浏览器Chrome。框架:Nuxt,默认配置
我通过 npm (通过 gitbash)使用npm install three --save. 它在 package.json 依赖项中为"three": "^0.116.1",。我在 ~/assets/ 中保存了一个 scene.json 文件,该文件是使用Three.js 编辑器> 导出场景生成的。
无论有或没有,我都会收到错误“无法在模块外部使用导入语句”type="module"
这是我正在使用的 Vue 组件:(它仅呈现给客户端。)
<template>
<div id="Three">
<div id="threeContainer"></div>
</div>
</template>
<script type="module">
import * as Three from 'three'
import OBJLoader from 'three/examples/jsm/loaders/OBJLoader.js'
export default {
name: 'Three',
data() {
return {
camera: null,
scene: null,
renderer: null,
mesh: null
}
},
mounted() {
this.init()
},
methods: {
init() {
const container …Run Code Online (Sandbox Code Playgroud)