mirror of
https://gitee.com/bitdance-team/chrome-extension
synced 2025-10-08 00:45:13 +08:00
style
This commit is contained in:
42
packages/shell-chrome/assets/js/todos.js
Normal file
42
packages/shell-chrome/assets/js/todos.js
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
let app = new Vue({
|
||||
data() {
|
||||
return {
|
||||
todos: [],
|
||||
todoForm: "",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadTodos () {
|
||||
axios.get("https://qcmma8.app.cloudendpoint.cn/api/memos?pageSize=100").then(res => {
|
||||
this.todos = res.data.content
|
||||
})
|
||||
},
|
||||
createTodo () {
|
||||
if (!this.toDoForm.trim()) {
|
||||
alert('内容不能为空')
|
||||
return
|
||||
}
|
||||
axios.post("https://qcmma8.app.cloudendpoint.cn/api/memos", { content: this.toDoForm }).then(() => {
|
||||
alert('添加成功!')
|
||||
this.loadTodos()
|
||||
this.toDoForm = ""
|
||||
})
|
||||
},
|
||||
removeTodo(id) {
|
||||
axios.delete(`https://qcmma8.app.cloudendpoint.cn/api/memos/${id}`, {
|
||||
content: this.toDoForm
|
||||
}).then(() => {
|
||||
alert('删除成功!')
|
||||
this.loadTodos()
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.loadTodos()
|
||||
}
|
||||
})
|
||||
|
||||
function sessionCb() {
|
||||
app.$mount('#app')
|
||||
}
|
Reference in New Issue
Block a user