2
0
mirror of https://github.com/tenrok/vue-tribute.git synced 2026-05-17 04:19:39 +03:00
Files
2021-04-11 16:37:55 -04:00

2 lines
4.0 KiB
JavaScript

!function(s){function t(t){for(var e,n,r=t[0],o=t[1],i=t[2],u=0,a=[];u<r.length;u++)n=r[u],c[n]&&a.push(c[n][0]),c[n]=0;for(e in o)Object.prototype.hasOwnProperty.call(o,e)&&(s[e]=o[e]);for(d&&d(t);a.length;)a.shift()();return p.push.apply(p,i||[]),l()}function l(){for(var t,e=0;e<p.length;e++){for(var n=p[e],r=!0,o=1;o<n.length;o++){var i=n[o];0!==c[i]&&(r=!1)}r&&(p.splice(e--,1),t=u(u.s=n[0]))}return t}var n={},c={0:0},p=[];function u(t){if(n[t])return n[t].exports;var e=n[t]={i:t,l:!1,exports:{}};return s[t].call(e.exports,e,e.exports,u),e.l=!0,e.exports}u.m=s,u.c=n,u.d=function(t,e,n){u.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},u.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)u.d(n,r,function(t){return e[t]}.bind(null,r));return n},u.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return u.d(e,"a",e),e},u.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},u.p="/vue-tribute/";var e=window.webpackJsonp=window.webpackJsonp||[],r=e.push.bind(e);e.push=t,e=e.slice();for(var o=0;o<e.length;o++)t(e[o]);var d=r;p.push([5,1]),l()}([function(t,e,n){},,,,,function(t,e,n){t.exports=n(10)},function(t,e,n){"use strict";var r=n(0);n.n(r).a},,,,function(t,e,n){"use strict";n.r(e);var r=n(4),o=n(1),i=n.n(o),u={name:"vue-tribute",props:{options:{type:Object,required:!0}},watch:{options:{immediate:!1,deep:!0,handler:function(){var e=this;this.tribute&&setTimeout(function(){var t=e.$slots.default[0].elm;e.tribute.detach(t),setTimeout(function(){t=e.$slots.default[0].elm,e.tribute=new i.a(e.options),e.tribute.attach(t),t.tributeInstance=e.tribute},0)},0)}}},mounted:function(){if(void 0===i.a)throw new Error("[vue-tribute] cannot locate tributejs!");var t=this.$slots.default[0].elm;this.tribute=new i.a(this.options),this.tribute.attach(t),t.tributeInstance=this.tribute,t.addEventListener("tribute-replaced",function(t){t.target.dispatchEvent(new Event("input",{bubbles:!0}))})},beforeDestroy:function(){var t=this.$slots.default[0].elm;this.tribute&&this.tribute.detach(t)},render:function(t){return t("div",{staticClass:"v-tribute"},this.$slots.default)}};"undefined"!=typeof window&&window.Vue&&window.Vue.component(u.name,u);var a={components:{VueTribute:u},data:function(){return{options:{trigger:"@",values:[{key:"Collin Henderson",value:"syropian"},{key:"Sarah Drasner",value:"sarah_edo"},{key:"Evan You",value:"youyuxi"},{key:"Adam Wathan",value:"adamwathan"}],positionMenu:!0,menuContainer:document.querySelector(".menu-container")}}},mounted:function(){this.options.menuContainer=this.$refs.menuContainer},methods:{noMatchFound:function(){console.log("No matches found!")},append:function(){var t=Math.random().toString(36).slice(2);this.options.values.push({key:t,value:t})}}},s=(n(6),n(3)),l=Object(s.a)(a,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"container"},[n("h1",[t._v("vue-tribute Demo")]),t._v(" "),n("h3",[t._v("Simple text input")]),t._v(" "),n("vue-tribute",{attrs:{options:t.options}},[n("input",{ref:"foo",attrs:{type:"text",placeholder:"@..."},on:{"tribute-no-match":t.noMatchFound}})]),t._v(" "),n("br"),t._v(" "),n("h3",[t._v("Textarea")]),t._v(" "),n("vue-tribute",{attrs:{options:t.options}},[n("textarea",{attrs:{placeholder:"@..."}})]),t._v(" "),n("br"),t._v(" "),n("h3",[t._v("contenteditable element")]),t._v(" "),n("vue-tribute",{attrs:{options:t.options}},[n("div",{staticClass:"content-editable",attrs:{contenteditable:"true",placeholder:"@..."}})]),t._v(" "),n("br"),t._v(" "),n("button",{staticClass:"btn",on:{click:t.append}},[t._v("Append New Item")])],1)},[],!1,null,null,null).exports;new r.a({el:"#app",render:function(t){return t(l)}})}]);
//# sourceMappingURL=main.252cc1c5.js.map