1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Vue.jsエラー】hogehoge is assigned a value but never used

Last updated at Posted at 2017-08-21

オブジェクト使ってないってことなので、newだけして回避するか、あるいはなんか使ってあげればよい。

 ERROR  Failed to compile with 1 errors                                                                                                               20:49:45

 error  in ./src/main.js


  ✘  http://eslint.org/docs/rules/no-unused-vars  'app2' is assigned a value but never used  
  src/main.js:17:5
  var app2 = new Vue({
       ^


✘ 1 problem (1 error, 0 warnings)


Errors:
  1  http://eslint.org/docs/rules/no-unused-vars

 @ multi ./build/dev-client ./src/main.js

コードはこんな

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})

var app2 = new Vue({
  el: '#app2',
  data: {
    message: 'Hello Vue!'
  }
})

// console.log(app2)

app2オブジェクトをなんでもいいので使ってあげると通った。

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})

var app2 = new Vue({
  el: '#app2',
  data: {
    message: 'Hello Vue!'
  }
})

console.log(app2)

newだけして回避してもいい。

new Vue({
    router
}).$mount('#app')
1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?