zoukankan      html  css  js  c++  java
  • elementui表格自定义格式实现原理???

    <html>
    
    <head>
        <title>学习</title>
        <meta charset="utf-8">
        <meta name="viewport"
            content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <script src="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
    
    </head>
    
    <body>
        <div id="body">
            <child value="2200" :formate="f"></child>
            <child value="2200"></child>
        </div>
    </body>
    <script>
        Vue.component('child', {
            props: {
                value: {
                    type: String
                },
                formate: {
    
                }
    
            },
            template: '<span>{{ showvalue }}</span>',
            data() {
                return {
                    showvalue: null
                }
    
            },
            methods: {
                childf() {
                    if (this.formate)
                        this.showvalue = this.formate(this.value)
                    else
                        this.showvalue = this.value
                },
            },
            created() {
                this.childf();
            }
        })
        new Vue({
            el: "#body",
            data: {
            },
    
            methods: {
                f(v) {
                    return v / 100;
                }
            }
        });
    </script>
    
    </html>
    

      

    后台兼职接单中,联系我微信:wjf88520

    by wujf

    mail:921252375@qq.com

  • 相关阅读:
    webpack浅析
    MongoDB简易
    async函数
    react -- context
    抓包移动端方法
    stateless 无状态组件
    移动端适配
    JS和JQuery获取和修改Label的值的示例代码
    HTML DOM querySelector() 方法
    filter
  • 原文地址:https://www.cnblogs.com/wujf/p/15637294.html
Copyright © 2011-2022 走看看