当添加带有'Umlaut'的字符串,例如'& Aumlpfel'的'Äpfel'到列表中以显示在自动完成 - 下拉列表中时,Umlaut在删除时正确显示('Äpfel')下载列表,但不是,一旦被选中'& Aumlpfel'。
我错过了什么? 请注意以下代码。非常感谢任何帮助。
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1,
maximum-scale = 1, minimum-scale = 1, user-scalable = no, minimal-ui" />
<meta name = "apple-mobile-web-app-capable" content = "yes" />
<meta name = "apple-mobile-web-app-status-bar-style" content = "black" />
<title>Autocomplete</title>
<link rel = "stylesheet"
href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.min.css" />
<link rel = "stylesheet"
href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.colors.min.css" />
</head>
<body>
<div class = "views">
<div class = "view view-main">
<div class = "pages">
<div data-page = "home" class = "page navbar-fixed">
<div class = "navbar">
<div class = "navbar-inner">
<div class = "left"> </div>
<div class = "center">Autcomplete</div>
<div class = "right"> </div>
</div>
</div>
<div class = "page-content">
<div class = "content-block-title">Dropdown With All Values</div>
<div class = "list-block">
<ul>
<li class = "item-content">
<div class = "item-title label">Fruits</div>
<div class = "item-input">
<input type = "text" placeholder = "Fruits" id = "autocomplete-dropdown-all">
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script type = "text/javascript"
src = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/js/framework7.min.js"></script>
<script>
var myApp = new Framework7();
var $$ = Dom7;
var mainView = myApp.addView('.view-main');
// Countries data array
var fruits = ('Apples Äpfel').split(' ');
// Dropdown with all values
var autocompleteDropdownAll = myApp.autocomplete ({
input: '#autocomplete-dropdown-all',
openIn: 'dropdown',
source: function (autocomplete, query, render) {
var results = [];
// You can find matched items
for (var i = 0; i < fruits.length; i++) {
if (fruits[i].toLowerCase().indexOf(query.toLowerCase()) >= 0)
results.push(fruits[i]);
}
// Display the items by passing array with result items
render(results);
}
});
</script>
</body>
</html>
答案 0 :(得分:0)
<meta charset="utf-8">
标题中缺少。那么就没有必要使用Umlaut的html类型
答案 1 :(得分:0)
Framework7似乎通过用变音符号代替变音符号来改变查询。因此,键入“Äpfel”似乎会在framework7中发送查询“ Apfel”,这使比较变得困难。
我通过覆盖查询字符串,从搜索栏值获取原始查询来解决此问题:
source: function (autocomplete, query, render) {
var results = [];
query = $("#autocomplete-dropdown-all")[0].value || query;
...