1.骨架屏组件封装
This commit is contained in:
@@ -34,9 +34,40 @@ const toggle = function () {
|
||||
|
||||
const copy = function () {
|
||||
const foundCodes = meta.value.getElementsByClassName('language-html')
|
||||
if (document.hasFocus()) {
|
||||
const text = foundCodes[0].textContent || "";
|
||||
const foundCode = foundCodes[0];
|
||||
let successful = false;
|
||||
// 使用原生系统剪贴板,只适用被授权安全的站点,http下不能使用
|
||||
if (navigator.clipboard && document.hasFocus()) {
|
||||
const text = foundCode.textContent || "";
|
||||
navigator.clipboard.writeText(text);
|
||||
successful = true;
|
||||
} else if (window.getSelection()){
|
||||
// 使用document.execCommand
|
||||
// 代码div显示状态直接使用,隐藏状态则创建一个div
|
||||
var range = document.createRange();
|
||||
let copyDiv;
|
||||
if (show.value) {
|
||||
range.selectNode(foundCode);
|
||||
} else {
|
||||
copyDiv = document.createElement('div');
|
||||
copyDiv.innerHTML = foundCode.innerHTML;
|
||||
copyDiv.style.position="fixed";
|
||||
copyDiv.style.left="-9999px";
|
||||
document.body.appendChild(copyDiv);
|
||||
range.selectNode(copyDiv);
|
||||
}
|
||||
window.getSelection()?.addRange(range);
|
||||
try {
|
||||
successful = document.execCommand('copy');
|
||||
} catch(err) {
|
||||
successful = false;
|
||||
console.error(err);
|
||||
}
|
||||
window.getSelection()?.removeAllRanges();
|
||||
copyDiv?.remove();
|
||||
}
|
||||
|
||||
if (successful) {
|
||||
layer.msg("复制成功", { icon : 1, time: 1000}, ()=>{})
|
||||
} else {
|
||||
layer.msg("复制失败", { icon : 2, time: 1000}, ()=>{})
|
||||
@@ -155,4 +186,4 @@ function handleScroll() {
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -28,9 +28,9 @@
|
||||
.lay-table-box table th {
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
white-space: nowrap; /*表头内容强制在一行显示*/
|
||||
background-color: #fafafa;
|
||||
}
|
||||
.lay-table-box table th,
|
||||
.lay-table-box table td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:void(0)"> 0.2.9 </a>
|
||||
<a href="javascript:void(0)"> 0.3.1 </a>
|
||||
</li>
|
||||
</ul>
|
||||
</lay-header>
|
||||
@@ -333,6 +333,12 @@ export default {
|
||||
subTitle: 'backtop',
|
||||
path: '/zh-CN/components/backtop',
|
||||
},
|
||||
{
|
||||
id: 43,
|
||||
title: '数字滚动',
|
||||
subTitle: 'countup',
|
||||
path: '/zh-CN/components/countup',
|
||||
},
|
||||
]
|
||||
|
||||
const handleClick = function (menu) {
|
||||
|
||||
@@ -309,6 +309,11 @@ const zhCN = [
|
||||
component: () => import('../../docs/zh-CN/components/backtop.md'),
|
||||
meta: { title: '返回顶部' },
|
||||
},
|
||||
{
|
||||
path: '/zh-CN/components/countup',
|
||||
component: () => import('../../docs/zh-CN/components/countup.md'),
|
||||
meta: { title: '数字滚动' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -314,6 +314,12 @@ export default {
|
||||
subTitle: 'carousel',
|
||||
path: '/zh-CN/components/carousel',
|
||||
},
|
||||
{
|
||||
id: 43,
|
||||
title: '数字滚动',
|
||||
subTitle: 'countUp',
|
||||
path: '/zh-CN/components/countup',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
>
|
||||
</div>
|
||||
<div class="site-version">
|
||||
<span>当前版本:v<cite class="site-showv">0.2.9</cite></span>
|
||||
<span>当前版本:v<cite class="site-showv">0.3.1</cite></span>
|
||||
<span
|
||||
><router-link
|
||||
class="layui-inline site-down"
|
||||
@@ -44,7 +44,7 @@
|
||||
rel="nofollow"
|
||||
class="site-star"
|
||||
>
|
||||
<i class="layui-icon"></i> Star <cite id="getStars">336</cite>
|
||||
<i class="layui-icon"></i> Star <cite id="getStars">521</cite>
|
||||
</a>
|
||||
<a
|
||||
href="https://gitee.com/layui-vue"
|
||||
|
||||
Reference in New Issue
Block a user