Mention.js 与提前输入冲突
Mention.js conflicts with typeahead
如果某个页面同时使用了 mentionjs 搜索字段和 bootstap typeahead,则 typeahead 将停止工作..
当我评论提及语句时,预输入开始工作。
任何指示?
Mention.js => Link
$(selector).mention({
delimiter: '#',
list: []
});
Bootstrap v2.3.2
$this.typeahead({
source: function(query, typeahead){
$.ajax({
url: url,
type: "GET",
data: "",
dataType: "JSON",
async: false,
success: function(data){
var hashList = new Array;
$.map(data, function(data){
var group;
group = {
val_id: data.id,
val: data.valName,
toString: function () {
return JSON.stringify(this);
},
toLowerCase: function () {
return this.drug.toLowerCase();
},
indexOf: function (string) {
return String.prototype.indexOf.apply(this.drug, arguments);
},
replace: function (string) {
return String.prototype.replace.apply(this.drug, arguments);
}
};
hashList.push(group);
});
typeahead(hashList);
}
});
},
property: 'val',
items:4,
updater: function (item) {
var item = JSON.parse(item);
console.log(item.id);
}
});
我不得不将 bootstrap typeahead 复制到另一个文件中,并将所有出现的 $.fn.typeahead 重命名为 $.fn.renamedtypeahed,然后将它们都导入
然后在 mention.js 插件中将所有出现的 $.fn.typeahead 重命名为 $.fn.renamedtypeahead。还有 1 个地方 _this.typeahead 需要相同的重命名。
现在不冲突了..不知道有没有其他方法可以快速解决
如果某个页面同时使用了 mentionjs 搜索字段和 bootstap typeahead,则 typeahead 将停止工作..
当我评论提及语句时,预输入开始工作。 任何指示?
Mention.js => Link
$(selector).mention({
delimiter: '#',
list: []
});
Bootstrap v2.3.2
$this.typeahead({
source: function(query, typeahead){
$.ajax({
url: url,
type: "GET",
data: "",
dataType: "JSON",
async: false,
success: function(data){
var hashList = new Array;
$.map(data, function(data){
var group;
group = {
val_id: data.id,
val: data.valName,
toString: function () {
return JSON.stringify(this);
},
toLowerCase: function () {
return this.drug.toLowerCase();
},
indexOf: function (string) {
return String.prototype.indexOf.apply(this.drug, arguments);
},
replace: function (string) {
return String.prototype.replace.apply(this.drug, arguments);
}
};
hashList.push(group);
});
typeahead(hashList);
}
});
},
property: 'val',
items:4,
updater: function (item) {
var item = JSON.parse(item);
console.log(item.id);
}
});
我不得不将 bootstrap typeahead 复制到另一个文件中,并将所有出现的 $.fn.typeahead 重命名为 $.fn.renamedtypeahed,然后将它们都导入
然后在 mention.js 插件中将所有出现的 $.fn.typeahead 重命名为 $.fn.renamedtypeahead。还有 1 个地方 _this.typeahead 需要相同的重命名。
现在不冲突了..不知道有没有其他方法可以快速解决