VUE component模板

注意:<script type="text/javascript">标签是js下,而模板:<template id="upLoading">标签只能在html标签下,所以把模板做成js使用不了,只能写在当前HTML引用页面一起加载



HTML的使用:

<up-loading ref="ss"></up-loading>

<%- include('./../../../Main/views/vue_component/ui') %>
VUE 调用:

that.$refs.ss.Open('xxx');

Open为模板里的方法,ss不能有大写字母,不然无法识别。

   

<!-- UpLoading -->
<template id="upLoading">
<div >
    <input v-show="show" id="fileSelect" name="fileSelect"  @change="update" ref="inputer" type="file" multiple/>
</div>
</template>
<script type="text/javascript">
    "use strict";
    Vue.component('up-loading', {    //不能有大写
        template    : '#upLoading',
        props: {
            drop: {
                default: false,
            },
            value: {        //前端传来的插槽值
                type: Array,
                default: Array,
            },
        },
        data() {      //写法不能改变
            return{
                show: true,
                files:[],
            }

        },


        watch: {
            files:function () {
                console.log("file changed");
            }
        },

        methods: {

            update: function () {
               
               

            },

            fileopen:function () {
              
            },

            filepost:function () {
                
              
            },

            //file列表删除
            delfile:function (index) {
                //this.files.remove(index);
            },

            unselect () {
                this.$refs.table1.unSelectAll()
            },
        }

    });
</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值