Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

今天新开了个Django项目,创建好数据库模型后输入: 1python manage.py makemigrations appname 结果提示错误: 12django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.Did you install mysqlclient? 解决方法: 1.首先,安装...

先来看一下后台的代码:

这里说的关键字查询,是要实现输入 fire water这两个词,然后后台将这两个词进行模糊查询。

Vue部分,用户在搜索框输入需要查询的内容后,前端将用户输入的内容进行判断,如果有空格,那么根据空格将字符串分开;如果没有空格,那么无需分开。

1
2
3
4
5
6
7
8
9
// indexOF方法找到目标返回1,找不到目标返回-1, text是用户输入的数据
if(this.text.indexOf(' ') !== -1){
// 将数据分开, 此方法返回的是一个对象而不是列表
this.text = this.text.split(' ')
// 将数据转化,转化之后数据形如:["1", "2"]
this.text = JSON.stringify(this.text)
}
// 获取后台数据
this.get_goods();

前端的处理就这么简单,那么到后台了:

首先,获取参数:

首先先建一张表,该表拥有四个字段,其中有三个整型字段: id, gid(商品id), uid(用户id)。有一个字符串变量: content,用来存储评论。

那么首先

Vue代码:

页面代码(其中input框并不需要):

1
2
3
4
<div id='upload'>
拖拽上传
<input type="file" @change='yp_upload'>
</div>



愿火焰指引你