首页 > 使用单个vue页面编写vue插件,在template里面使用template做循环,但是webpack编译后,不能执行

使用单个vue页面编写vue插件,在template里面使用template做循环,但是webpack编译后,不能执行

我使用单个vue文件,在<template>里面使用<template v-for="key in array">,在webpack编译后,运行没有显示内容。


<style>
.display{
  width:300px;
  height:30px;
  background-color:#d5d5d5;
  text-align:center;
}
</style>
<template>
<template v-for="key in array">
<div class="display">{{key}}</div>
</template>
</template>
<script>
export default{
  data:function(){
    return {
        array:[1,2,3,4,5,6]
    };
  }
}
</script>
webpack.config.js配置
module:{
        loaders: [
          {test: /\.vue$/, loader: 'vue' }]
},
vue: { // vue的配置
        loaders: {
          js: 'babel',
          css: ExtractTextPlugin.extract('vue-style-loader', 'css-loader')
        }
    },
package.json配置
"devDependencies": {
    "babel-core": "^6.11.4",
    "babel-loader": "^6.2.4",
    "babel-plugin-transform-runtime": "^6.12.0",
    "babel-preset-es2015": "^6.9.0",
    "babel-runtime": "^6.11.6",
    "css-loader": "^0.23.1",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.9.0",
    "glob": "^7.0.5",
    "html-webpack-plugin": "^2.22.0",
    "style-loader": "^0.13.1",
    "url-loader": "^0.5.7",
    "vue": "^1.0.26",
    "vue-hot-reload-api": "^1.3.3",
    "vue-html-loader": "^1.2.3",
    "vue-loader": "^8.5.3",
    "vue-style-loader": "^1.0.0",
    "webpack": "^1.13.1",
    "webpack-dev-server": "^1.14.1"
  }

报这个错TypeError: factory.call is not a function


template标签可以这样用吗? ? ? 你要不要换个div试一下

【热门文章】
【热门文章】