小编May*_*ino的帖子

使用.NET(MVC)的模板实现(VUE)的问题

我正在尝试实现外部模板(创建HTML页面),但是我无法成功。该页面是一个包含Vue应用程序的ASP.NET MVC页面。

我想将此组件的模板部分移至外部文件,但是无论何时这样做都行不通。

以下内容(以下)可以正常工作,但是由于缺少文本编辑功能,因此不容易维护或构建。

Vue.component('my-component',{模板:'#my-component'}

这是当前的代码,它可以完美地工作:

var foo = Vue.component('foo', {
template:'
<table class="table">
 <template v-for="(foo, ColName, index) in foos">
    <template v-if="index % 3 == 0">
        <tr>
        </tr>
    </template>
    <th>{{ColName}}</th>
    <td v-if="foo">{{foo}}</td>
    <td v-else> -- </td>
 </template>
</table>',
data: function () { 
  return {
    foos: null,
    NumColuns: 3 
  }
}, 
mounted() { 
 axios
  .get('/api/account/foo/')
  .then(response => {
    this.foos = response.data                
   })
  .catch(error => {
    console.log(error1)
      this.errored = true
  })
  .finally(() => this.loading = false)
}
});
var foo …
Run Code Online (Sandbox Code Playgroud)

javascript asp.net-mvc vue.js

5
推荐指数
1
解决办法
161
查看次数

标签 统计

asp.net-mvc ×1

javascript ×1

vue.js ×1