Skip to content

Commit

Permalink
fix: wangeditor 不能多个的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Jun 11, 2021
1 parent 57bca5d commit 81a5211
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,28 @@ export const crudOptions = (vm) => {
}
}
}
},
{
title: '内容2',
key: 'content_wang2',
sortable: true,
width: 300,
type: 'editor-wang', // 富文本图片上传依赖file-uploader,请先配置好file-uploader
disabled: true, // 设置true可以在行展示中隐藏
form: {
component: {
disabled: () => {
return vm.getEditForm().disable
},
props: {
index: 2,
config: {
// withCredentials: false,
// uploadImgServer: 'http://localhost:7070/api/upload/form/upload'
}
}
}
}
}
]
}
Expand Down
24 changes: 12 additions & 12 deletions packages/d2-crud-plus-example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4015,19 +4015,19 @@ cz-conventional-changelog@3.3.0, cz-conventional-changelog@^3.2.0:
optionalDependencies:
"@commitlint/load" ">6.1.1"

d2-crud-plus@^2.16.1:
version "2.16.1"
resolved "https://registry.npm.taobao.org/d2-crud-plus/download/d2-crud-plus-2.16.1.tgz#496baf568911e56278305d9c5ed2a48740936362"
integrity sha1-SWuvVokR5WJ4MF2cXtKkh0CTY2I=
d2-crud-plus@^2.16.6:
version "2.16.7"
resolved "https://registry.npmjs.org/d2-crud-plus/-/d2-crud-plus-2.16.7.tgz#43accdcc23ee5b4f7082acc3c9dc9b2c02126a1c"
integrity sha512-rx+GoZW6vcJo9ebLGD5AxChkn7NMysUFWbJIEKrvJ3V+9cvTh0hBiUDpvTgAQ55EJHvI8PxaxtmkNPeDe3B7cg==
dependencies:
dayjs "^1.8.17"
vue "^2.6.11"
vuedraggable "^2.24.0"

d2-crud-x@^2.16.0:
version "2.16.0"
resolved "https://registry.npm.taobao.org/d2-crud-x/download/d2-crud-x-2.16.0.tgz#e70f374653279df3e5fb8c68ce8648e168498804"
integrity sha1-5w83RlMnnfPl+4xozoZI4WhJiAQ=
d2-crud-x@^2.16.6:
version "2.16.6"
resolved "https://registry.npmjs.org/d2-crud-x/-/d2-crud-x-2.16.6.tgz#b48be86c03cea6ec054f1d2338291d44e227106e"
integrity sha512-KtNoeLoIrS175ZeCVWvnND3BetNwiPXYVfLrK6M5tnez2yuAAhE4cApXscQABOV3earlqE2ZOEHKDWsY00M8dQ==
dependencies:
lodash.clonedeep "^4.5.0"
lodash.foreach "^4.5.0"
Expand All @@ -4036,10 +4036,10 @@ d2-crud-x@^2.16.0:
lodash.merge "^4.5.0"
lodash.set "^4.3.2"

d2p-extends@^2.16.1:
version "2.16.1"
resolved "https://registry.npm.taobao.org/d2p-extends/download/d2p-extends-2.16.1.tgz#c127928c6550c16df6fb94fc59cf839b9a6d84c4"
integrity sha1-wSeSjGVQwW32+5T8Wc+Dm5pthMQ=
d2p-extends@^2.16.6:
version "2.16.7"
resolved "https://registry.npmjs.org/d2p-extends/-/d2p-extends-2.16.7.tgz#686a7795ee5891ad6b5729808d8cab5faab3b591"
integrity sha512-1QLxKHbIUs8rNQpMkzHSaQtDz/GKbytSQPDtZe4vF4nZdL8LvraVUzBoOxZWsY9qIQUZwUa/9otLHIY2slDWgQ==
dependencies:
base64-js "^1.3.0"
china-division "^2.2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<template>
<div class="d2p-wangeditor">
<div id="wEditor"></div>
<div :id="id"></div>
<textarea name="" class="wang-editor-preview" readonly v-model="currentValue"></textarea>
</div>
</template>

<script>
import WangEditor from 'wangeditor'
// import { D2pUploader } from 'd2p-extends'
import lodash from 'lodash'
Expand All @@ -25,6 +26,12 @@ export default {
config: {
type: Object
},
/**
* 同一个页面多个edit时,需要配置不同的index
*/
index: {
default: '1'
},
uploader: {
type: Object,
default: () => {
Expand All @@ -39,6 +46,11 @@ export default {
options: {}
}
},
computed: {
id () {
return 'wangeditor' + this.index
}
},
watch: {
value: {
handler (val) {
Expand All @@ -63,7 +75,7 @@ export default {
},
methods: {
init () {
const editor = new WangEditor('#wEditor')
const editor = new WangEditor('#' + this.id)
lodash.merge(wangConfig, this.config)
lodash.merge(editor.config, wangConfig)
editor.config.onchange = (newHtml) => {
Expand Down
42 changes: 38 additions & 4 deletions packages/d2-crud-plus-extends/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -920,13 +920,28 @@
"@babel/types" "^7.4.4"
esutils "^2.0.2"

"@babel/runtime-corejs3@^7.11.2":
version "7.14.5"
resolved "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.14.5.tgz#0d9bf00d59c0b73185c462c323efffd0f4c37283"
integrity sha512-cBbwXj3F2xjnQJ0ERaFRLjxhUSBYsQPXJ7CERz/ecx6q6hzQ99eTflAPFC3ks4q/IG4CWupNVdflc4jlFBJVsg==
dependencies:
core-js-pure "^3.14.0"
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.11.0":
version "7.11.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736"
integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.11.2":
version "7.14.5"
resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.5.tgz#665450911c6031af38f81db530f387ec04cd9a98"
integrity sha512-121rumjddw9c3NCQ55KGkyE1h/nzWhU/owjhw0l4mQrkzz4x9SGS1X8gFLraHwX7td3Yo4QTL+qj0NcIzN87BA==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.4.4", "@babel/runtime@^7.8.4":
version "7.9.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.9.2.tgz#d90df0583a3a252f09aaa619665367bae518db06"
Expand Down Expand Up @@ -2902,6 +2917,11 @@ core-js-compat@^3.6.2, core-js-compat@^3.6.5:
browserslist "^4.8.5"
semver "7.0.0"

core-js-pure@^3.14.0:
version "3.14.0"
resolved "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.14.0.tgz#72bcfacba74a65ffce04bf94ae91d966e80ee553"
integrity sha512-YVh+LN2FgNU0odThzm61BsdkwrbrchumFq3oztnE9vTKC4KS2fvnPmcx8t6jnqAyOTCTF4ZSiuK8Qhh7SNcL4g==

core-js@^3.6.5:
version "3.6.5"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a"
Expand Down Expand Up @@ -3179,10 +3199,10 @@ cyclist@^1.0.1:
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=

d2-crud-plus@^2.13.5:
version "2.13.5"
resolved "https://registry.yarnpkg.com/d2-crud-plus/-/d2-crud-plus-2.13.5.tgz#f593fd0af8411d739cfc455d6c82a61fdb5426cb"
integrity sha512-WlSpEfz2BUW1/nes7viRBiq4UCm/mjnj+0kFwhZEvUlueuiEcIO3eO060Sg1BN1AgYF3JjTTTJEZEqTOAO8U3w==
d2-crud-plus@^2.16.6:
version "2.16.7"
resolved "https://registry.npmjs.org/d2-crud-plus/-/d2-crud-plus-2.16.7.tgz#43accdcc23ee5b4f7082acc3c9dc9b2c02126a1c"
integrity sha512-rx+GoZW6vcJo9ebLGD5AxChkn7NMysUFWbJIEKrvJ3V+9cvTh0hBiUDpvTgAQ55EJHvI8PxaxtmkNPeDe3B7cg==
dependencies:
dayjs "^1.8.17"
vue "^2.6.11"
Expand Down Expand Up @@ -8468,6 +8488,11 @@ tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35"
integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==

tslib@^2.1.0:
version "2.2.0"
resolved "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==

tty-browserify@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
Expand Down Expand Up @@ -8822,6 +8847,15 @@ vuedraggable@^2.24.0:
dependencies:
sortablejs "^1.10.1"

wangeditor@^4.6.6:
version "4.7.3"
resolved "https://registry.npmjs.org/wangeditor/-/wangeditor-4.7.3.tgz#135407960cb728cb10c850e685557049e807d87e"
integrity sha512-O6mbZkpGPksGWHYl7dKtYFbdfULn5oS7DYF9RS1WpG9rBumqa5CtLaxryc6P0i4IYb/fKRE55hD2XpkPzILpjg==
dependencies:
"@babel/runtime" "^7.11.2"
"@babel/runtime-corejs3" "^7.11.2"
tslib "^2.1.0"

watchpack@^1.6.0:
version "1.6.1"
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.1.tgz#280da0a8718592174010c078c7585a74cd8cd0e2"
Expand Down
8 changes: 4 additions & 4 deletions packages/d2-crud-plus/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3236,10 +3236,10 @@ cyclist@^1.0.1:
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=

d2-crud-x@^2.13.1:
version "2.13.1"
resolved "https://registry.yarnpkg.com/d2-crud-x/-/d2-crud-x-2.13.1.tgz#c7ef7b80baf77cf0646013aa982a93c31ca2b51b"
integrity sha512-DfjPKwxIInOc/fG2lLPVj6GA5/znX2OzfgNWf8amTAsRtbTkbwCTbCp3BxmZxcS9OJAwxYbwiZ0U/GQD9UA3cg==
d2-crud-x@^2.16.6:
version "2.16.6"
resolved "https://registry.npmjs.org/d2-crud-x/-/d2-crud-x-2.16.6.tgz#b48be86c03cea6ec054f1d2338291d44e227106e"
integrity sha512-KtNoeLoIrS175ZeCVWvnND3BetNwiPXYVfLrK6M5tnez2yuAAhE4cApXscQABOV3earlqE2ZOEHKDWsY00M8dQ==
dependencies:
lodash.clonedeep "^4.5.0"
lodash.foreach "^4.5.0"
Expand Down
5 changes: 0 additions & 5 deletions packages/d2-crud-x/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8714,11 +8714,6 @@ vue-template-es2015-compiler@^1.9.0:
resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz#1ee3bc9a16ecbf5118be334bb15f9c46f82f5825"
integrity sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==

vue@^2.6.11:
version "2.6.11"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.11.tgz#76594d877d4b12234406e84e35275c6d514125c5"
integrity sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ==

watchpack@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.1.tgz#280da0a8718592174010c078c7585a74cd8cd0e2"
Expand Down

0 comments on commit 81a5211

Please sign in to comment.