zoukankan      html  css  js  c++  java
  • Vue::is特性用法

     看完之后能感觉到就是想要把blog-post-row的内容放在table中的tr标签中,是通过:is特性来进行使用的。但是感觉不知道具体怎么用,那就下面的这个示例再直观的感受一下:


    <template>
    <div class="hello">
    <h1>{{ msg }}</h1>
    <h2>Essential Links</h2>

    <div id="app1">
    <el-table :data="tableData">
    <el-table-column is="blog_post_row"></el-table-column>
    </el-table>
    </div>

    </div>
    </template>

    <script>
    export default {
    name: 'HelloWorld',
    data () {
    return {
    tableData: [{
    date: '2016-05-02',
    name: '王小虎',
    address: '上海市普陀区金沙江路 1518 弄'
    }, {
    date: '2016-05-04',
    name: '王小虎',
    address: '上海市普陀区金沙江路 1517 弄'
    }, {
    date: '2016-05-01',
    name: '王小虎',
    address: '上海市普陀区金沙江路 1519 弄'
    }, {
    date: '2016-05-03',
    name: '王小虎',
    address: '上海市普陀区金沙江路 1516 弄'
    }],
    msg: 'Welcome to Your Vue.js App'
    }
    },
    methods: {},
    components: {
    blog_post_row: {
    template: `
    <div>
    <el-table-column prop="date" label="日期" width="180"></el-table-column>
    <el-table-column prop="name" label="姓名" width="180"></el-table-column>
    <el-table-column prop="address" label="地址" width="180"></el-table-column>
    </div>
    `
    }
    }
    }
    </script>

    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped>
    </style>
    ————————————————
    也可以看一下其他朋友的示例哈: 


    <template>
    <div class="hello">
    <h1>{{ msg }}</h1>
    <h2>Essential Links</h2>

    <div id="app1">
    <button @click="toshow">点击让子组件显示</button>
    <component :is="which_to_show"></component>
    </div>

    </div>
    </template>

    <script>
    import Vue from 'vue'
    /* eslint-disable no-new */

    export default {
    name: 'HelloWorld',
    data () {
    return {
    which_to_show: 'first',
    msg: 'Welcome to Your Vue.js App'
    }
    },
    methods: {
    toshow: function () {
    var arr = ['first', 'second', 'third', '']
    var index = arr.indexOf(this.which_to_show)
    if (index < 3) {
    this.which_to_show = arr[index + 1]
    } else {
    this.which_to_show = arr[0]
    }
    }
    },
    components: {
    first: {
    template: `<div>这里是子组件</div>`
    },
    second: {
    template: `<div>这里是子组件2</div>`
    },
    third: {
    template: `<div>这里是子组件3</div>`
    }
    }
    }
    </script>

    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped>
    </style>
    ————————————————

    看到我的div了吗?在你那你就完蛋了
  • 相关阅读:
    Programming Windows 第五版读书笔记 第三章 窗口和消息
    一个带游标的遍历数据的函数|数据库操作|软件开发
    递归删除一个文件夹下的所有文件c#代码
    杭州市市民卡办理点
    NTLDR is missing 的解决方法
    SQL Server中 将日期格式化.函数 CONVERT
    1.显示网页中的所有图片
    用sql函数获取中文字符串的全拼
    地柜便利一个文件夹下的所有文件|软件开发
    软件是什么
  • 原文地址:https://www.cnblogs.com/web-shu/p/11970314.html
Copyright © 2011-2022 走看看