vue esview 控件拖拽问题(二)Vue.directiove自定义命令

控件拖拽问题(二)

initDropEvents是绑定在bind中的(droppable.js)
而这个droppable是在install_derictive.js中定义的定义命令,
Vue.directive(‘droppable’,droppable)
Vue.directive(‘editable’,editable)
这两个自定义命令在main.js中被执行:
import installDirective from “./plugin/install_directive”//don’t delete,let vue install
理论上我们应该看到v-droppable 和v-editable这些自定义命令在程序中的使用调用,但是没有。
我们看到在后台调用getRichPage中
getRichPage.call(this, this.pageSoulId, (data) => {
this.opModel = data
let ancestorSoul = parse(data.pageSoul)
addRenderFn(ancestorSoul)
resetUid(ancestorSoul.maxUid)
saveSoul()
this.setSoul(ancestorSoul)
walkSoul(ancestorSoul, (soul) => {
resetSoul(soul)
从后台得到的getRichPage的code是这样定义的:
在这里插入图片描述
其中,pageSoul如下定义的code:
“exports.cid = ‘100’
exports.name = ‘DropPanel’;
exports.nickname = ‘DropPanel’;
exports.type = ‘Div’;
exports.template=<div{model}>{slot}</div>
exports.desc = ‘拖拽安置面板’;
exports.allow = [];
exports.template= <Div{model} {slotName}>{slot}</Div>
exports.model = {
style: {
type: ‘json’,
value:{},
desc: ‘value’
}
};
exports.script = function () {
};
exports.render = function (createElement) {
const context = this
const store = createElement.store
if(!context.initScript){
context.initScript=true
}
return createElement(‘Div’, {
style:context.model.style.value,
domProps: {
controlConfig: this
},
directives: [
{
name: ‘droppable’
}
],
‘class’: {
‘soul-drop-panel’: true
},
nativeOn: {
click: function (e) {
store.commit(‘dragModule/clear’, e)
}
}
}, context.children.map(function (child) {
return child.render(createElement)
}))
}”
这个代码中定义了dropPanel的render函数,并creatElement,在el中定义了自定义函数droppable:
directives: [
{
name: ‘droppable’
}
也就是说在dropPanel中定义了自定义函数droppable,droppable bind了onDrop等函数,但是为什么onDragEnd和OnDropOver等函数都不响应呢,只响应dragStart?
function initDropEvents(drag) {
drag.ondragenter = onDragEnter
drag.ondragover = onDragOver
drag.ondrop = onDrop
drag.ondragleave = onDragLeave
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

柔贝特三哥

你的鼓励是我坚持创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值