初步完成搜索功能

deploy
DESKTOP-4RNDQIC\29019 2020-06-18 00:14:40 +08:00
parent e036e35d1c
commit 614e20f596
2 changed files with 9 additions and 10 deletions

View File

@ -62,6 +62,7 @@ class Blog extends Controller
$content = $markdown->text($doc[0]['content']); $content = $markdown->text($doc[0]['content']);
$typedocs = $docModel->getAllTypeDocs(); $typedocs = $docModel->getAllTypeDocs();
$doccoment = $commentModel->DocComments($id); $doccoment = $commentModel->DocComments($id);
$titles = $docModel->AllTitle();
echo '</pre>'; echo '</pre>';
if(\App\Config::$DEBUG) if(\App\Config::$DEBUG)
View::renderTemplate("/blog/basic.html", View::renderTemplate("/blog/basic.html",
@ -78,6 +79,7 @@ class Blog extends Controller
"comments" => $doccoment, "comments" => $doccoment,
"comment_count" => count($doccoment), "comment_count" => count($doccoment),
"docid"=>$id, "docid"=>$id,
"alltitle" => $titles,
]); ]);
else else
View::renderTemplate("/blog/basic.html",[ View::renderTemplate("/blog/basic.html",[
@ -91,6 +93,7 @@ class Blog extends Controller
"comments" => $doccoment, "comments" => $doccoment,
"comment_count" => count($doccoment), "comment_count" => count($doccoment),
"docid"=>$id, "docid"=>$id,
"alltitle" => $titles,
]); ]);
}else{ }else{
View::renderTemplate("/blog/basic.html",['title'=>'test','index'=>false]); View::renderTemplate("/blog/basic.html",['title'=>'test','index'=>false]);

View File

@ -174,14 +174,9 @@ ul li a{
<option>{{ title.title }}</option> <option>{{ title.title }}</option>
{% endfor %} {% endfor %}
</select> </select>
<button style=" font-size: 25px; background: #20375f; color: white;" >
确定
</button>
</form> </form>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<?php echo {{ route }} ?> <?php echo {{ route }} ?>
@ -221,11 +216,12 @@ ul li a{
appendTo: 'body', appendTo: 'body',
duration: 200, duration: 200,
} }
).on('select.editable-select', function (e, li) { ).on('select.editable-select',function (e,li) {
console.log(e); console.log(li.text());
}).on('shown.editable-select',function (e,li) { window.location.replace("{{ url }}article?title=" + li.text() + "&type=0");
console.log(e);
}); });
function toTitle() {
console.log($('#editable-select').innerText);
}
</script> </script>
</body> </body>