第一次我没注意用的5.1,是可以创建成功的,改了5.3就不行
额,你用的什么版本, MariaDB版本怎么修改呢
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the r
ight syntax to use near 'json not null, remember_token
varchar(100) null, created_at
timestamp null, ' at line 1 (SQL: create table users
(id
int unsigned not n
ull auto_increment primary key, name
varchar(255) not null, email
varchar(255) not null, password
varchar(60) not null, avatar
varchar(255) not null, `confirmat
ion_token varchar(255) not null,
is_active smallint not null default '0',
questions_count int not null default '0',
answers_count int not null default '0',
comm
ents_count int not null default '0',
favorites_count int not null default '0',
likes_count int not null default '0',
followers_count int not null default '0',
f
ollowings_count int not null default '0',
settings json not null,
remember_token varchar(100) null,
created_at timestamp null,
updated_at` timestamp null) defau
lt character set utf8 collate utf8_unicode_ci)
[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the r
ight syntax to use near 'json not null, remember_token
varchar(100) null, created_at
timestamp null, ' at line 1
我的5.3无法通过migrate创建表,报SQLSTATE[42000]错误,通过create-project,composer create-project --prefer-dist laravel/laravel xx创建的项目,网上找了很多没有头绪,请教一下,谢谢
好吧,自己蠢没仔细看完文档,文档都已经很详细的解释了。
https://vuex.vuejs.org/zh-cn/forms.html
因为我写的mutations跟这个问题没什么关系所以我就没贴
const mutations = {
[types.ADD_TODO] (state, todo) {
state.all.push(todo)
},
[types.DELETE_TODO] (state, index) {
state.all.splice(index,1)
},
[types.COMPLETE_TODO] (state, todo) {
todo.completed = ! todo.completed
},
[types.RECEIVE_TODOS] (state, todos) {
state.all = todos
}
}
TodoForm表单里面的input是 v-model="newTodo.title"
每次输入一个字母就会出现那个state报错
这种实时输入更改title的mutations要怎么写?
我尝试将Vue2.0js项目的代码改成Vuex的application structure结构,但是遇到了一点问题。
错误是在添加新的todo时,在input中改变newTodo的title会报错
说是不能再mutation范围外修改state,但是我不知道应该怎么改。
store/index.js
import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import * as getters from './getters'
import todo from './modules/todo'
Vue.use(Vuex)
const debug = process.env.NODE_ENV !== 'production'
export default new Vuex.Store({
actions,
getters,
modules: {
todo
},
strict: debug
})
我把这里strict:debug去掉之后错误就消失了,但是我还是想找出错误在哪里。
todo.js
const state = {
all: [],
newTodo: {id:null, title:'', completed:false}
}
// getters
const getters = {
allTodos: state => state.all,
newTodo: state => state.newTodo
}
TodoForm.vue
import { mapGetters } from 'vuex'
export default{
computed: mapGetters({
newTodo: 'newTodo'
}),
methods:{
addTodo(newTodo) {
this.$store.dispatch('addTodo',newTodo)
},
}
}
终于等到更新啦哈哈
好的谢谢!!
想了想好像没什么必要分模块
module里面多个模块,每个模块里面有个对应的html和js和vue文件