Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
259 views
in Technique[技术] by (71.8m points)

javascript - Vue 3 TypeError (owl-carousel)

I am currently working in vue 3 with typescript. I would like to use the vue owl library (https://www.npmjs.com/package/vue-owl-carousel).

However, I get a message that I need to declare it which I did as follows:

tsconfig.json

"compilerOptions": {
    ...
  "include": [
    ...
    "src/owl/index.d.ts"
  ],
  ...
  }

owl index.d.ts

declare module "vue-owl-carousel";

vue component

<template>
  <div class="hello">
    <carousel>
      <img src="https://placeimg.com/200/200/any?1">
      <img src="https://placeimg.com/200/200/any?2">
      <img src="https://placeimg.com/200/200/any?3">
      <img src="https://placeimg.com/200/200/any?4">
    </carousel>
  </div>
</template>

<script lang="ts">
import { Options, Vue } from "vue-class-component";

import carousel from "vue-owl-carousel";

@Options({
  components: {
    carousel
  }
})
...
</script>

When I open the page I get a blank page and in the console this error appears: enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...