2022年3月

需求:

element-ui dialog弹窗设置点击空白处不关闭

描述

element-ui dialog弹窗 默认的点击空白处也就是非弹窗区会关闭,这在绝大部分情况下是非常不合适的,会造成弹窗中的数据清空。

我们将该属性改成只能点击右上方叉号关闭。

也就是“:close-on-click-modal” 这个属性设置成false 就可以了

代码

<el-dialog title="添加" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
</el-dialog>

1:项目初始化
@PostConstruct 被注解的方法,在对象加载完依赖注入后执行

@PostConstruct
public void init()
{
    List<SysDictType> dictTypeList = dictTypeMapper.selectDictTypeAll();
    for (SysDictType dictType : dictTypeList)
    {
        List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType());
        DictUtils.setDictCache(dictType.getDictType(), dictDatas);
    }
}

2:我们通常会结合数据库来实现数据字典,但事实上数据字典经常会被使用到,如果频繁地去访问数据库,将会对数据库造成性能压力,事实上我们经常会采用Redis对数据字典进行缓存来提升系统性能

String dictTypeTemp="logistics";
List<SysDictData> data = dictTypeService.selectDictDataByType(dictTypeTemp);

3:在SpringBoot中使用Junit进行Redis的链接测试;基于Ruoyi-Vue

package com.test;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class RedisCon {
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @Test
    public  void setArgs() throws Exception {
        stringRedisTemplate.opsForValue().set("aaa", "111");
        Assert.assertEquals("111", stringRedisTemplate.opsForValue().get("aaa"));
    }
}

SMS即为:Single Message Service。现在很流行发送短信进行校验验证码之类的,而发送短信是需要money的;我们可选择的提供发送短信接口的来源有很多,下面给出一个使用阿里云提供的短信服务,来发送SMS的示例。

- 阅读剩余部分 -