在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML/ 為什么不能創(chuàng)建vue實(shí)例呢?

為什么不能創(chuàng)建vue實(shí)例呢?

<template>
<div class="hello">

<h1>{{ msg }}</h1>
<h2>Essential Links</h2>
<ul>
  <li>
    <a
      
      target="_blank"
    >
      Core Docs
    </a>
  </li>
  <li>
    <a
      
      target="_blank"
    >
      Forum
    </a>
  </li>
  <li>
    <a
      
      target="_blank"
    >
      Community Chat
    </a>
  </li>
  <li>
    <a
      
      target="_blank"
    >
      Twitter
    </a>
  </li>
  <br>
  <li>
    <a
      
      target="_blank"
    >
      Docs for This Template
    </a>
  </li>
</ul>
<h2>Ecosystem</h2>
<ul>
  <li>
    <a
      
      target="_blank"
    >
      vue-router
    </a>
  </li>
  <li>
    <a
      
      target="_blank"
    >
      vuex
    </a>
  </li>
  <li>
    <a
      
      target="_blank"
    >
      vue-loader
    </a>
  </li>
  <li>
    <a
      
      target="_blank"
    >
      awesome-vue
    </a>
  </li>
</ul>
<div id="showTest">
  <h1>{{msg2}}</h1>
  <h1>{{details()}}</h1>
</div>

</div>
</template>

<script>

import Vue from 'vue'

export default {
name: 'HelloWorld',
data () {

return {
  msg: 'Welcome to Your Vue.js App'
}

}
}

var vm = new Vue({
el: '#showTest',
data () {

return {
  msg2: 'this is only a test',
  state: 'is it success ?'
}

},
methods: {

details: function () {
  return this.state + ' you are right !!!! '
}

}
})

// Vue.use({
// vm
// })
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1,
h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

顯示錯(cuò)誤說(shuō) 'vm' is assigned a value but never used 所以我想知道如何引入自己創(chuàng)建的Vue對(duì)象

回答
編輯回答
解夏

你把 var vm = 去掉試試?yán)?/p>

2017年5月12日 08:59
編輯回答
墨染殤

并不是太理解為何要這樣來(lái)做。目的是出于什么呢

2017年7月18日 00:53
編輯回答
葬憶

建議將整個(gè).vue文件截圖看看。
看不是很清楚,不知道你什么地方有問(wèn)題。

2017年12月20日 07:31