当前位置:网站首页>[untitled] Notepad content writing area
[untitled] Notepad content writing area
2022-04-23 05:26:00 【Courtesy.】

HTML
<div>
<div>
// title
<div>
<input
type="text"
placeholder=" title ..."
value="{
{title}}" // stay data Definition title Variable
maxlength="20" // Input at most 20 A word
onchange="getTitle"
/>
</div>
// Content
<div>
<textarea
placeholder=" Input content "
value="{
{content}}" // stay data Definition content Variable
onchange="getContent"
></textarea>
</div>
// label
<text> Add a tag ~</text>
<div>
<text
class="{
{label == ' Ordinary '?'common':''}}" // stay data Definition label Variable , And write the default value
onclick="changeLabel(' Ordinary ')"
> Ordinary </text>
<text
class="{
{label == ' important '?'important':''}}"
onclick="changeLabel(' important ')"
> important </text>
<text
class="{
{label == ' To do '?' to-do':''}}"
onclick="changeLabel(' To do ')"
> To do </text>
</div>
</div>
// Finish button opacity: Transparency of color When the button canAdd When clickable, the transparency is 1 Otherwise 0.3 namely 30%
<div>
<text onclick="addMemo" style="opacity: {
{canAdd ? '1' : '0.3'}};" > complete </text>
</div>
</div>
JS
// The introduction of the file
import {
getMemoList, setMemoList } from '../../helper/data.js'
import router from '@system.router'
.......
data() {
return {
index: '',
title: '',
content: '',
label: ' Ordinary '
}
},
.......
// title οnchange="getTitle"
getTitle(e) {
this.title = e.value
},
// Content οnchange="getContent"
getContent(e) {
this.content = e.value
},
// label
changeLabel(label) {
this.label = label
},
// complete οnclick="addMemo"
computed: {
canAdd() {
if (this.title && this.content) {
return true // When content and title are detected “ complete ” Button to click true otherwise false
} else {
return false
}
}
},
.........
// Asynchronous operations
async addMemo() {
if (this.title && this.content) {
const memoAdd= {
title: this.title,
content: this.content,
label: this.label,
timestamp: +new Date(),
is_top:false,
}
const memoList = await getMemoList()
if (this.index !== '') {
memoList[this.index] = memoAdd
} else {
memoList.push(memoAdd)
}
setMemoList(memoList)
router.back()
}
},
版权声明
本文为[Courtesy.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220544338977.html
边栏推荐
- JSP-----JSP简介
- 2021-11-01
- Graphics.FromImage报错“Graphics object cannot be created from an image that has an indexed pixel ...”
- SQLyog的基本使用
- After NPM was upgraded, there was a lot of panic
- es6数组的使用
- Uncle wolf is looking for a translator -- Plato -- ongoing translation
- Redis in node -- ioredis
- 使用宝塔+xdebug+vscode远程调试代码
- Requirements for SQL server to retrieve SQL and user information
猜你喜欢

Excel 2016 打开文件第一次打不开,有时空白,有时很慢要打开第二次才行

mariadb数据库的主从复制

2021-10-12

Quick app bottom navigation bar

JSP-----JSP简介

What role do tools play in digital transformation?

!!!!!!!!!!!!!!!!!!

To understand Devops, you must read these ten books!

Domain driven model DDD (III) -- using saga to manage transactions

工具在数字化转型中扮演了什么样的角色?
随机推荐
Blender程序化地形制作
The title bar will be pushed to coincide with the status bar
Use pagoda + Xdebug + vscode to debug code remotely
領域驅動模型DDD(三)——使用Saga管理事務
JS Array常见方法
After NPM was upgraded, there was a lot of panic
[the background color changes after clicking a line]
Study notes: unity customsrp-10-point and spot shadows
Cross domain CORS relationship~
es6数组的使用
JSP -- Introduction to JSP
工具在数字化转型中扮演了什么样的角色?
TSlint注释忽略错误和RESTful理解
Modèle axé sur le domaine DDD (III) - gestion des transactions à l'aide de Saga
日志简介和构建web应用
Create a tabbar component under the components folder, which is public
2021-09-28
How to add beautiful code blocks in word | a very complete method to sort out and compare
selenium预先加载cookie的必要性
Output string in reverse order