UNPKG

@livelybone/vue-table

Version:

A vue table component, support width change

10 lines (8 loc) 2.44 kB
/** * Bundle of @livelybone/vue-table * Generated: 2019-08-04 * Version: 3.0.0 * License: MIT * Author: 2631541504@qq.com */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).TableBaseVueTable=e()}(this,function(){"use strict";return function(t,e,n,r,s,a,o,i,d,l){"boolean"!=typeof o&&(d=i,i=o,o=!1);var c,f="function"==typeof n?n.options:n;if(t&&t.render&&(f.render=t.render,f.staticRenderFns=t.staticRenderFns,f._compiled=!0,s&&(f.functional=!0)),r&&(f._scopeId=r),a?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,d(t)),t&&t._registeredComponents&&t._registeredComponents.add(a)},f._ssrRegister=c):e&&(c=o?function(){e.call(this,l(this.$root.$options.shadowRoot))}:function(t){e.call(this,i(t))}),c)if(f.functional){var u=f.render;f.render=function(t,e){return c.call(e),u(t,e)}}else{var y=f.beforeCreate;f.beforeCreate=y?[].concat(y,c):[c]}return n}({render:function(){var s=this,t=s.$createElement,a=s._self._c||t;return a("table",{staticClass:"vue-table table-base"},[s.noHead?s._e():a("thead",{staticClass:"thead"},[a("tr",{staticClass:"tr",style:s.headTrStyle},s._l(s.heads,function(t,e){return a("th",{key:e,staticClass:"th",style:t.style,on:{click:function(t){return s.$emit("clickTh",{ev:t,th:e})}}},[s._v("\n "+s._s(t.headformatter?t.headFormatter(t.title):t.title)+"\n "),s._t("th-"+e)],2)}),0)]),s._v(" "),s.data&&0<s.data.length?a("tbody",{staticClass:"tbody",style:{maxHeight:"30vh"}},s._l(s.data,function(n,r){return a("tr",{key:r,staticClass:"tr",style:Object.assign({},s.trStyle,r%2==1?s.evenTrStyle:{}),on:{click:function(t){return s.$emit("clickTr",{ev:t,tr:r})}}},s._l(s.heads,function(t,e){return a("td",{key:e,staticClass:"td",style:t.tdStyle||t.style,on:{click:function(t){return s.$emit("clickTd",{ev:t,tr:r,td:e})}}},[a("div",{staticClass:"td-value",domProps:{innerHTML:s._s(t.formatter?t.formatter(n,t.key):n[t.key])}}),s._v(" "),s._t("td-"+r+"-"+e)],2)}),0)}),0):s._e()])},staticRenderFns:[]},void 0,{name:"TableBase",props:{heads:{default:function(){return[]},type:[Array,Object]},data:{default:function(){return[]},type:[Array,Object]},headTrStyle:Object,trStyle:Object,evenTrStyle:Object,noHead:Boolean}},void 0,!1,void 0,void 0,void 0)});