<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title><![CDATA[微4e]]></title> 
<atom:link href="https://www.v4e.cn/rss.php" rel="self" type="application/rss+xml" />
<description><![CDATA[为前端开发者搭建的交流家园]]></description>
<link>https://www.v4e.cn/</link>
<language>zh-cn</language>
<generator>www.emlog.net</generator>
<item>
    <title>CSS outline实现图片内描边</title>
    <link>https://www.v4e.cn/post-200.html</link>
    <description><![CDATA[<pre><code class="language-scss">.img{
 width: 90px;
 height: 120px;
 border-radius: 4px;
 outline: 1px solid rgba(0,0,0,.8);
 outline-offset:-1px;
}</code></pre>
<p>和box-shadow对比有啥优缺点?<br />
box-shadow不能覆盖在图片上</p>
<p>圆角 outline 的兼容性如何？<br />
Safari对圆角的支持稍差，要16.4</p>]]></description>
    <pubDate>Wed, 22 May 2024 09:28:00 +0800</pubDate>
    <dc:creator>yang</dc:creator>
    <guid>https://www.v4e.cn/post-200.html</guid>
</item>
<item>
    <title>el-table实现单选功能</title>
    <link>https://www.v4e.cn/post-199.html</link>
    <description><![CDATA[<h3>利用Element-UI组件中的el-table实现选择功能，官方提供了两种选择方式，一种是单选，一种是多选。我需要实现单选的效果</h3>
<h2>第一步：监听checkbox 的点击事件（选中和取消选中）</h2>
<pre><code class="language-html"> &lt;el-table
 :data="tableData"
 ref="myTable"
 stripe border
 row-key="id"
 :header-cell-style="headerClass"
 :cell-style="cellClass"
 @selection-change="handleSelectionChange"
 &gt;
 &lt;!-- 出现多选模式的selection选择框 只需要加上以下一行就可以 --&gt;
 &lt;el-table-column type="selection" width="50" align="center"&gt;&lt;/el-table-column&gt;
 &lt;el-table-column label="权限名称" width="160px"&gt;
    &lt;template slot-scope="scope"&gt;
      &lt;svg-icon icon-class="role2" :style="{ color: scope.row.iconColor ? scope.row.iconColor : '#000000' }"&gt;&lt;/svg-icon&gt;
      &lt;span&gt;{{ scope.row.roleName }}&lt;/span&gt;
    &lt;/template&gt;
 &lt;/el-table-column&gt;
 &lt;el-table-column label="权限描述" prop="remark" show-overflow-tooltip&gt; &lt;/el-table-column&gt;
 &lt;/el-table&gt;
</code></pre>
<h2>第二步：利用el-table提供的方法处理数据</h2>
<pre><code class="language-javascript">    selectionChange(row) {
      // console.log("🚀 ~ selectionChange ~ row:", row);
      // this.selectionRowList = row;
      // if (row.length &gt; 1) {
      //   // 如果选择超过一个选项，则只保留最后一个选项
      //   row.splice(0, row.length - 1);
      // }
      this.selectionRowList = row;

      if (row.length &gt; 1) {
        this.$refs.myTable.clearSelection();
        this.$refs.myTable.toggleRowSelection(row.pop());
      }
      if (row.length != 0) {
        this.selectProtocolId = row[row.length - 1].id;
      }
    },</code></pre>
<p>解释一下上面的这个函数，<br />
selectionRowList 用来接收选中的行数据，最后需要返回给父元素，<br />
selectProtocolId 用来解决数据回显的问题，第三步会讲到这一步为什么要修改<br />
clearSelection 用来清除所有选中的数据<br />
toggleRowSelection 用来切换某一行的状态，参数是某行的整条数据<br />
这样就能简单的利用多选模式的样式来实现单选</p>
<h2>第三步：数据回显</h2>
<p>上面两步已经能实现基本功能，这一步解决的是回显的问题。选中数据后，想要再次修改，存在一些小小的坑<br />
item.id去取当前数据的唯一id值就好，注意放置的顺序！！！！！！！</p>
<pre><code class="language-javascript">this.tableData.forEach((item,index) =&gt; {
    if(item.id == this.selectProtocolId){
        this.$nextTick(() =&gt; {
            this.$refs.myTable.toggleRowSelection(item);
        })
    }
})
</code></pre>
<p>想要展示选中的数据，首先得与数据源进行比较，tableData是分页拿到的数据。<br />
selectProtocolId的初始值是props中传递过来的一个参数（无法修改props属性的值，只能用一个中间变量来控制），代表上一次保存的数据。往后每次点击切换的时候，都需要动态的更新这个值（第二步中提到的内容），否则就会出现某两页都有数据被选中的情况，因为不改变selectProtocolId的值，总会有某页的某条数据与之匹配<br />
$nextTick确保在DOM更新时切换数据选中状态的代码能正常执行，否则直接执行，无法设置选中状态</p>
<h2>第四步：禁用全选功能</h2>
<pre><code class="language-scss">::v-deep .el-table__header-wrapper  .el-checkbox{
    //找到表头那一行，然后把里面的复选框隐藏掉
    display:none
}
</code></pre>]]></description>
    <pubDate>Sun, 19 May 2024 16:00:00 +0800</pubDate>
    <dc:creator>yang</dc:creator>
    <guid>https://www.v4e.cn/post-199.html</guid>
</item>
<item>
    <title>在el-dialog的title中文字标题前面添加一个图标</title>
    <link>https://www.v4e.cn/post-198.html</link>
    <description><![CDATA[<h2>代码示例：</h2>
<p><img src="https://www.v4e.cn/content/uploadfile/202404/60b51714275564.png" alt="" /></p>
<h2>效果图：</h2>
<p><img src="https://www.v4e.cn/content/uploadfile/202404/9d511714275665.png" alt="" /></p>]]></description>
    <pubDate>Sun, 28 Apr 2024 11:33:00 +0800</pubDate>
    <dc:creator>yang</dc:creator>
    <guid>https://www.v4e.cn/post-198.html</guid>
</item>
<item>
    <title>创建好的链接在打开时换浏览器出现的问题</title>
    <link>https://www.v4e.cn/post-197.html</link>
    <description><![CDATA[<p>当前浏览器创建好链接过后换到其他浏览器打开会显示报错,无法实现在没有在登陆时就跳转到登陆，以及其他逻辑实现<br />
<img src="https://www.v4e.cn/content/uploadfile/202404/4a471712886472.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202404/fb5c1712886611.png" alt="" /></p>
<p>这是因为在当前浏览器打开的时候是在本地存储里面取值,可以直接打开链接,但是换了浏览器过后他在本地没有存储值,这时就无法在本地存储里面获取到对应的值，所以就需要做出修改</p>
<h2>如下代码做出修改：</h2>
<p><img src="https://www.v4e.cn/content/uploadfile/202404/09dd1712887008.png" alt="" /></p>]]></description>
    <pubDate>Fri, 12 Apr 2024 09:44:00 +0800</pubDate>
    <dc:creator>yang</dc:creator>
    <guid>https://www.v4e.cn/post-197.html</guid>
</item>
<item>
    <title>时间格式使用插件转化</title>
    <link>https://www.v4e.cn/post-196.html</link>
    <description><![CDATA[<h2>参考网站:</h2>
<p><a href="https://momentjs.bootcss.com/" title="时间格式插件">时间格式插件</a></p>
<h2>安转:</h2>
<p>npm install moment --save   # npm<br />
yarn add moment             # Yarn<br />
Install-Package Moment.js   # NuGet<br />
spm install moment --save   # spm<br />
meteor add momentjs:moment  # meteor<br />
bower install moment --save # bower (deprecated)</p>
<h2>引用:</h2>
<p>import moment from &quot;moment&quot;;<br />
import &quot;moment/locale/zh-cn&quot;; // 导入中文语言包</p>
<h2>实例使用如下:</h2>
<h2>html写法:</h2>
<pre><code class="language-html">&lt;el-table-column prop="ecmTime" label="填报时间" :formatter="formatEcmTime" show-overflow-tooltip&gt;&lt;/el-table-column&gt;</code></pre>
<h2>JS写法:</h2>
<pre><code class="language-javascript"> computed: {
    formatEcmTime() {
      return (row) =&gt; {
        const formatted = moment(row.ecmTime).format("YYYY-MM-DD"); // 使用Moment.js格式化日期
        return formatted;
      };
    }
  },</code></pre>]]></description>
    <pubDate>Wed, 10 Apr 2024 14:21:00 +0800</pubDate>
    <dc:creator>yang</dc:creator>
    <guid>https://www.v4e.cn/post-196.html</guid>
</item>
<item>
    <title>Git安装流程</title>
    <link>https://www.v4e.cn/post-195.html</link>
    <description><![CDATA[<p><img src="https://www.v4e.cn/content/uploadfile/202403/4a471709790185.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/fb5c1709790198.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/10fb1709790211.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/09dd1709790225.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/82661709790236.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/f19c1709790246.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/9eb91709790255.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/602e1709790268.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/7afb1709790279.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/586e1709790289.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/59b21709790300.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/9eb61709790314.png" alt="" /></p>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/c00b1709790325.png" alt="" /></p>]]></description>
    <pubDate>Thu, 07 Mar 2024 13:42:00 +0800</pubDate>
    <dc:creator>yang</dc:creator>
    <guid>https://www.v4e.cn/post-195.html</guid>
</item>
<item>
    <title>vue2组件懒加载写法以及穿透属性</title>
    <link>https://www.v4e.cn/post-194.html</link>
    <description><![CDATA[<h2>组件懒加载</h2>
<pre><code class="language-javascript">  components: {
    //组件懒加载(用到时才会加载)
    yuMemberHighGrade: () =&gt; import("@/views/components/yu-dept-member/yu-member-highGrade.vue")
  },</code></pre>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/4a471709255463.png" alt="" /></p>
<h2>穿透属性</h2>
<p><img src="https://www.v4e.cn/content/uploadfile/202403/c8981709255542.png" alt="" /></p>]]></description>
    <pubDate>Fri, 01 Mar 2024 09:07:00 +0800</pubDate>
    <dc:creator>yang</dc:creator>
    <guid>https://www.v4e.cn/post-194.html</guid>
</item>
<item>
    <title>饼图去掉折线和折线的提示文字</title>
    <link>https://www.v4e.cn/post-193.html</link>
    <description><![CDATA[<h2>原代码</h2>
<p><img src="https://www.v4e.cn/content/uploadfile/202402/f19c1709118141.png" alt="" /></p>
<h2>原饼图</h2>
<p><img src="https://www.v4e.cn/content/uploadfile/202402/4a471709118076.png" alt="" /></p>
<h2>修改代码</h2>
<p><img src="https://www.v4e.cn/content/uploadfile/202402/09dd1709118112.png" alt="" /></p>
<pre><code class="language-javascript">series: [
        //数据序列
        {
          name: "我的任务",
          type: "pie",
          radius: "50%",
          data: [
            { value: 735, name: "未完成", itemStyle: { color: "#ffdc60" } },
            { value: 484, name: "已完成", itemStyle: { color: "#ff915a" } }
          ],

          // 去掉折线以及折线提示文字
          label: {
            normal: {
              show: false
            }
          },
          labelLine: {
            normal: {
              show: false
            }
          },

          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: "rgba(0, 0, 0, 0.7)"
            }
          }
        }
      ]</code></pre>
<h2>实现饼图</h2>
<p><img src="https://www.v4e.cn/content/uploadfile/202402/fb5c1709118169.png" alt="" /></p>]]></description>
    <pubDate>Wed, 28 Feb 2024 18:57:00 +0800</pubDate>
    <dc:creator>yang</dc:creator>
    <guid>https://www.v4e.cn/post-193.html</guid>
</item>
<item>
    <title>手搓实现选中的样式切换</title>
    <link>https://www.v4e.cn/post-192.html</link>
    <description><![CDATA[<pre><code class="language-html">&lt;template&gt;
  &lt;div class="note-sends"&gt;
    &lt;el-dialog title="分享《无标题》笔记" :visible.sync="dialogVisible" width="680px" :before-close="handleClose"&gt;
      &lt;div&gt;
        &lt;div&gt;
          &lt;el-input style="margin-right: 10px" v-model="input" placeholder="点击按钮,创建分享链接" :disabled="isDisabled"&gt;&lt;/el-input&gt;
          &lt;div class="sendsinput"&gt;
            &lt;el-button type="info" @click="cancellation"&gt;取消分享&lt;/el-button&gt;
            &lt;el-button type="primary" @click="CreateShare"&gt;创建分享&lt;/el-button&gt;
          &lt;/div&gt;
        &lt;/div&gt;

        &lt;div&gt;
          &lt;p style="font-size: 15px; font-weight: bold"&gt;设置&lt;/p&gt;

          &lt;div class="btn"&gt;
            &lt;div class="btnpassword"&gt;
              &lt;span style="font-weight: bold;  margin-right: 8px;"&gt; 分享范围 &lt;/span&gt;

              &lt;div class="btnSharing" @click="PublicSharing"&gt;
                &lt;img v-show="showFirstImage == 0" src="../../../assets/images/note/yuan.png" class="imgyuan" alt="" /&gt;
                &lt;img v-show="showFirstImage == 1" src="../../../assets/images/note/yuan1.png" class="imgyuan" alt="" /&gt;
                &lt;span :style="{color: textColor,'font-weight': boldText ? 'bold' : 'normal','margin-right': '8px'}"&gt;公开分享&lt;/span&gt;
              &lt;/div&gt;
              &lt;span style="font-size: 12px ;color: #a8afbb"&gt;所有人均可查看&lt;/span&gt;
            &lt;/div&gt;

            &lt;div class="btnlimitation"&gt;
              &lt;div class="btnteg" @click="toggleContent"&gt;
                &lt;img v-show="showtoggle == 0" src="../../../assets/images/note/yuan.png" class="imgyuan" alt="" /&gt;
                &lt;img v-show="showtoggle == 1" src="../../../assets/images/note/yuan1.png" class="imgyuan" alt="" /&gt;
                &lt;span :style="{color: texttoggle,'font-weight': toggletext ? 'bold' : 'normal','margin-right': '8px'}"&gt;系统内分享&lt;/span&gt;
              &lt;/div&gt;
              &lt;span style="font-size: 12px ;color: #a8afbb"&gt;登录系统用户可查看&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;

          &lt;div class="content"&gt;
            &lt;div class="password"&gt;
              &lt;el-button style="background-color: #fff; color: black; border: none" type="primary" icon="el-icon-lock" @click="setPassword"
                &gt;设置密码&lt;/el-button
              &gt;
              &lt;el-input v-if="isPasswordVisible" style="width: 100px; margin-left: 10px" v-model="Password" placeholder="密码"&gt;&lt;/el-input&gt;
            &lt;/div&gt;

            &lt;div class="limitation"&gt;
              &lt;span style="color: #a8afbb; "&gt;分享限制&lt;/span&gt;
              &lt;el-dropdown&gt;
                &lt;el-button style="background-color: #fff; color: black; border: none" type="primary"&gt;
                  不限&lt;i class="el-icon-arrow-down el-icon--right"&gt;&lt;/i&gt;
                &lt;/el-button&gt;
                &lt;el-dropdown-menu slot="dropdown"&gt;
                  &lt;el-dropdown-item&gt;不限&lt;/el-dropdown-item&gt;
                  &lt;el-dropdown-item disabled&gt;分享天数&lt;/el-dropdown-item&gt;
                  &lt;el-dropdown-item&gt;1&lt;/el-dropdown-item&gt;
                  &lt;el-dropdown-item&gt;3&lt;/el-dropdown-item&gt;
                  &lt;el-dropdown-item&gt;7&lt;/el-dropdown-item&gt;
                  &lt;el-dropdown-item disabled&gt;阅读次数&lt;/el-dropdown-item&gt;
                  &lt;el-dropdown-item&gt;30&lt;/el-dropdown-item&gt;
                  &lt;el-dropdown-item&gt;50&lt;/el-dropdown-item&gt;
                  &lt;el-dropdown-item&gt;100&lt;/el-dropdown-item&gt;
                &lt;/el-dropdown-menu&gt;
              &lt;/el-dropdown&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div v-if="showContent"&gt;
        &lt;p style="color: #a8afbb"&gt;
          好友列表
          &lt;span style="color: red; margin-left: 15px"&gt;必填，如不填写“好友分享”不生效&lt;/span&gt;
        &lt;/p&gt;
        &lt;el-input style="margin-right: 10px" v-model="inputuser" placeholder="输入用户邮箱或手机号后点击回车"&gt;&lt;/el-input&gt;
      &lt;/div&gt;
    &lt;/el-dialog&gt;
  &lt;/div&gt;
&lt;/template&gt;
</code></pre>
<pre><code class="language-javascript">&lt;script&gt;
export default {
  data() {
    return {
      showContent: false,
      dialogVisible: false,
      value: true,
      input: "",
      Password: "",
      inputuser: "",
      isDisabled: true,
      isPasswordVisible: false,

      showFirstImage: 0,
      boldText: false,
      textColor: "black",

      showtoggle: 0,
      toggletext: false,
      texttoggle: "black"
    };
  },
  methods: {
    atclick() {
      this.dialogVisible = true;
    },

    // 随机生成四位数密码
    setPassword() {
      // 生成一个随机的1到9中的四位数
      const randomPassword = Math.floor(Math.random() * 9000) + 1000;

      // 将生成的随机数赋值给v-model绑定的data属性（例如：Password）
      this.Password = randomPassword.toString();
      // this.isPasswordVisible = true;
      this.isPasswordVisible = !this.isPasswordVisible;
    },

    // 创建分享
    CreateShare() {
      this.isDisabled = !this.isDisabled;
    },

    //取消分享
    cancellation() {
      this.isDisabled = true;
    },

    // 系统内分享
    toggleContent() {
      this.showContent = !this.showContent;

      this.showtoggle = this.showtoggle ? 0 : 1;
      this.toggletext = !this.toggletext;
      this.texttoggle = this.showtoggle ? "#1296db" : "black";

      this.showFirstImage = 0;
      this.boldText = false;
      this.textColor = "black";
    },

    // 公开分享
    PublicSharing() {
      this.showContent = false;

      this.showFirstImage = this.showFirstImage ? 0 : 1;
      this.boldText = !this.boldText;
      this.textColor = this.showFirstImage ? "#1296db" : "black";

      this.showtoggle = 0;
      this.toggletext = false;
      this.texttoggle = "black";
      console.log("公开分享");
    },

    handleClose(done) {
      this.$confirm("确认关闭？")
        .then((_) =&gt; {
          done();
        })
        .catch((_) =&gt; {});
    }
  }
};
&lt;/script&gt;</code></pre>
<pre><code class="language-scss">&lt;style lang="scss" scoped&gt;
.sendsswitch {
  display: flex;
  align-items: center;
}

.imgyuan {
  width: 15px;
  height: 15px;
  margin-right: 8px;
}

.sendsinput {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 25px 0;
}
.btn {
  margin-bottom: 20px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .btnpassword {
    display: flex;
    width: 40%;
    align-items: center;

    .btnSharing {
      cursor: pointer;
      display: flex;
      align-items: center;
    }
  }
  .btnlimitation {
    width: 40%;
    display: flex;
    align-items: center;
    .btnteg {
      display: flex;
      align-items: center;
      cursor: pointer;
    }
  }
}

.content {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .password {
    width: 40%;
  }

  .limitation {
    width: 40%;
  }
}
&lt;/style&gt;
</code></pre>
<h1>弹窗在其他页面使用</h1>
<pre><code class="language-html">&lt;!-- 分享 --&gt;
      &lt;div class="iconBox" @click="lookVissble"&gt;
        &lt;svg-icon icon-class="sends" /&gt;
      &lt;/div&gt;
       &lt;!-- 分享弹框 --&gt;
      &lt;noteSends ref="noteSendsShow" /&gt;</code></pre>
<pre><code class="language-javascript">
//引进组件
import noteSends from "@/views/note-sends.vue";

//注册组件
  components: { noteSends },
//点击打开组件
  methods: {
    lookVissble() {
      this.$refs.noteSendsShow.atclick();
    },
}</code></pre>]]></description>
    <pubDate>Fri, 02 Feb 2024 16:03:00 +0800</pubDate>
    <dc:creator>yang</dc:creator>
    <guid>https://www.v4e.cn/post-192.html</guid>
</item>
<item>
    <title>el-option循环到的数据时,不需要显示label</title>
    <link>https://www.v4e.cn/post-191.html</link>
    <description><![CDATA[<pre><code class="language-html"> :label="'\u00A0'" //不能删除这个元素,只能用特殊符号来代替显示</code></pre>]]></description>
    <pubDate>Mon, 29 Jan 2024 15:26:00 +0800</pubDate>
    <dc:creator>yang</dc:creator>
    <guid>https://www.v4e.cn/post-191.html</guid>
</item></channel>
</rss>