Vue3与.NET6实战之开发杂记3

使用Swiper实现轮播图

老规矩,先看效果:
Vue3与.NET6实战之开发杂记3_第1张图片
关键代码如下:

                  <div style="margin-top: 70px">
                    <swiper :modules="modules">
                      <swiper-slide
                        ><ul>
                          <li>
                            <img
                              src="https://qpic.y.qq.com/music_cover/mgDVmicyKxZ16zUS0YqmTPktr1eoIeiaPbxfWfLiaHcVWTJOfn7S0ND8pzFyHicEC4cd/600?n=1"
                              style="width: 205px"
                            />
                            <p style="width: 224px">【(0.8x降速】当emo慢下来时p>
                            <a>播放量:1789.7万a>
                          li>

                          <li>
                            <img
                              src="https://qpic.y.qq.com/music_cover/3sZgibm04hICGbleGFmh9STkeNmVibbbvOsPicnNTLAWChNzUIxyfFvQA/300?n=1"
                              style="width: 205px"
                            />
                            <p style="width: 224px">难忘经典:回放磁带里的青春岁月p>
                            <a>播放量:1789.7万a>
                          li>

                          <li>
                            <img
                              src="https://qpic.y.qq.com/music_cover/qySHBaLckrOIYib7GXCWmDbG7K4GRBmyC88HLWlrTRMSK6CmFAIm43UZuTj4vBxhP/300?n=1"
                              style="width: 205px"
                            />
                            <p style="width: 224px">音综封神现场:顶级编唱震撼人心p>
                            <a>播放量:1.2万a>
                          li>

                          <li>
                            <img
                              src="https://qpic.y.qq.com/music_cover/jiaJRGwJnWdhpt92PaG8l5bqEwiaL1o3ueVOfLzyOmz7trhIicib9wibEgA/300?n=1"
                              style="width: 205px"
                            />
                            <p style="width: 224px">耳机控收藏,享受另类孤独情绪p>
                            <a>播放量:30.0万a>
                          li>
                          <li>
                            <img
                              src="https://qpic.y.qq.com/music_cover/hlGJXnBgr8xrqs7IPIpEkb090bdZM8hAb955FkgzmGLZdaMv6hLF0w/300?n=1"
                              style="width: 205px"
                            />
                            <p style="width: 224px">续相思·唱段风月往事p>
                            <a>播放量:31.0万a>
                          li>
                        ul>swiper-slide
                      >
                      <swiper-slide
                        ><ul>
                          <li>
                            <img
                              src="https://qpic.y.qq.com/music_cover/gaSSCRswoq7NlpHA8vK1PuRiaKlew1z7prD5vzyP1Ju3QYeiclfG0P4Q/300?n=1"
                              style="width: 205px"
                            />
                            <p style="width: 224px">那些年一属于周杰伦的R&B时代p>
                            <a>播放量:1789.7万a>
                          li>

                          <li>
                            <img
                              src="https://qpic.y.qq.com/music_cover/ZS2nmh1hWV2OESzO7MBLDzA7xl3Tf4Tz26sXvTRlkFjvRpaETbicHZQ/300?n=1"
                              style="width: 205px"
                            />
                            <p style="width: 224px">明明很想念,却不敢再去打扰你p>
                            <a>播放量:1789.7万a>
                          li>

                          <li>
                            <img
                              src="https://qpic.y.qq.com/music_cover/qySHBaLckrOIYib7GXCWmDbG7K4GRBmyCFoDqHm3R8zjnYLooxtEj63hvgB1vE8TT/300?n=1"
                              style="width: 205px"
                            />
                            <p style="width: 224px">车载DJ热歌:轻松一路Fun肆嗨!p>
                            <a>播放量:1.2万a>
                          li>

                          <li>
                            <img
                              src="https://qpic.y.qq.com/music_cover/p5Qmf0LevmgOiaQdIJJAYy7DHMB7uj0beWibibmmLqEeia18MHVEd0w5zQ/300?n=1"
                              style="width: 205px"
                            />
                            <p style="width: 224px">海外爆火神曲·nternet Hitsp>
                            <a>播放量:30.0万a>
                          li>
                          <li>
                            <img
                              src="https://qpic.y.qq.com/music_cover/3sZgibm04hICGbleGFmh9SbW1XTBkGx4g6xz7GeGJYdJujuSjmDGwLQ/300?n=1g"
                              style="width: 210px"
                            />
                            <p style="width: 224px">『8090青春』唤醒记忆的时代乐章p>
                            <a>播放量:30.0万a>
                          li>
                        ul>swiper-slide
                      >
                    swiper>
                  div>

Identity实现基于角色授权

Program.cs中添加配置

            services.AddIdentityCore<User>(options =>
            {
               
            }).AddRoles<Role>();

这里的Role是实现IdentityRole接口的类,只要实现Identity接口即可
Role类

    public class Role : IdentityRole<long>
    {
    }

在Controller中添加注解[Authorize(Roles= "Admin")],这里Role的内容由自己决定
Vue3与.NET6实战之开发杂记3_第2张图片

你可能感兴趣的:(C#自学,asp.net)