본문 바로가기

Web :: Framework/Vue.js

컴포넌트 import error vue/multi-word-component-names 해결법

error Component name "Discount" should always be multi-word

이 오류는 Vue.js의 vue/multi-word-component-names 규칙을 위반해서 나오는 에러임

해결법은 간단합니다. 컴포넌트 이름을 수정하면 오류를 수정할 수 있습니다

// 에러 문구
error Component name "Discount" should always be multi-word
vue/multi-word-component-names

 

// 이전 컴포넌트 이름
name: 'Discount',

// 수정된 컴포넌트 이름 (예시)
name: 'DiscountCalculator',

생성한 컴포넌트 파일에서: Discount > DiscountCalculator로 수정

<script> 안의 name을 import 하는 메인파일과 이름이 겹쳐지지 않게 수정하면 됩니다

 

import Discount from './Discount.vue 경로'

export default {
  data() {

  },
  components : {
    Discount : Discount, //이 부분
  }
}