chunk-c485c15c.7845e652.js 2.5 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-c485c15c"],{"3e7a":function(t,e,a){"use strict";a("aa72")},"466d":function(t,e,a){"use strict";var n=a("c65b"),r=a("d784"),c=a("825a"),o=a("7234"),s=a("50c4"),l=a("577e"),i=a("1d80"),u=a("dc4a"),d=a("8aa5"),f=a("14c3");r("match",(function(t,e,a){return[function(e){var a=i(this),r=o(e)?void 0:u(e,t);return r?n(r,e,a):new RegExp(e)[t](l(a))},function(t){var n=c(this),r=l(t),o=a(e,n,r);if(o.done)return o.value;if(!n.global)return f(n,r);var i=n.unicode;n.lastIndex=0;var u,h=[],v=0;while(null!==(u=f(n,r))){var g=l(u[0]);h[v]=g,""===g&&(n.lastIndex=d(r,s(n.lastIndex),i)),v++}return 0===v?null:h}]}))},"8b69":function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"app-container"},[a("div",{staticClass:"editable-content",attrs:{contenteditable:"true"},domProps:{innerHTML:t._s(t.formattedData)},on:{click:t.handleClick}})])},r=[],c=(a("13d5"),a("fb6a"),a("b64b"),a("d3b7"),a("4d63"),a("c607"),a("ac1f"),a("2c3e"),a("25f0"),a("466d"),a("5319"),a("498a"),a("159b"),{data:function(){return{rawData:"dt{qq}fdtrd{qq}ycy{aaa}cyc",eject:"{['qq', 'ww'], ['qq', 'rrr', 'ttt'], ['aaa', 'sss']}"}},computed:{formattedData:function(){console.log(this.rawData.replace("{qq}","1111"));var t=this.rawData;return this.rawData.match(/{.*?}/g).forEach((function(e,a){console.log(e,a,t,"str1"),t=t.replace(e,'<span class="clickable" contenteditable="false">'.concat(e,"</span>"))})),t}},methods:{convertToArray:function(t){var e=t.trim().slice(1,-1);e=e.replace(/'/g,'"');try{var a=JSON.parse("[".concat(e,"]"));return a}catch(n){return console.error("解析失败:",n),[]}},replaceFirstOccurrence:function(t,e,a){return t.replace(new RegExp(e,"g"),(function(t,e,n){return n.substr(0,e).indexOf(t)===e?a:t}))},extractBracesContent:function(t){var e=t.match(/{.*?}/g);return console.log(e,"matches"),e||[]},handleClick:function(t){console.log(t.target,12312);var e=this.convertToArray(this.eject),a=this.extractBracesContent(this.rawData);console.log(a,"extractedContent");var n=a.reduce((function(t,a,n){return console.log(e[n],t[a],n,"acc, key, index"),t[a]=e[n],t}),{});if(console.log(t.target.textContent,"event.target.textContent"),t.target.classList.contains("clickable"))for(var r=0,c=Object.keys(n);r<c.length;r++){var o=c[r];t.target.textContent===o&&alert(n[o])}}}}),o=c,s=(a("3e7a"),a("2877")),l=Object(s["a"])(o,n,r,!1,null,null,null);e["default"]=l.exports},aa72:function(t,e,a){}}]);