fix: 删除不必要的代码
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "log-lottery",
|
"name": "log-lottery",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
1
src/components.d.ts
vendored
1
src/components.d.ts
vendored
@@ -11,7 +11,6 @@ declare module 'vue' {
|
|||||||
EditSeparateDialog: typeof import('./components/NumberSeparate/EditSeparateDialog.vue')['default']
|
EditSeparateDialog: typeof import('./components/NumberSeparate/EditSeparateDialog.vue')['default']
|
||||||
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
|
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
|
||||||
ImageSync: typeof import('./components/ImageSync/index.vue')['default']
|
ImageSync: typeof import('./components/ImageSync/index.vue')['default']
|
||||||
NumberSeparate: typeof import('./components/NumberSeparate/index.vue')['default']
|
|
||||||
PlayMusic: typeof import('./components/PlayMusic/index.vue')['default']
|
PlayMusic: typeof import('./components/PlayMusic/index.vue')['default']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
|
|||||||
@@ -54,15 +54,12 @@ watch(totalNumber, (val) => {
|
|||||||
}
|
}
|
||||||
separatedNumberRef.value.showModal()
|
separatedNumberRef.value.showModal()
|
||||||
scaleList.value = new Array(separatedNumber.value.length + 1).fill(totalNumber.value)
|
scaleList.value = new Array(separatedNumber.value.length + 1).fill(totalNumber.value)
|
||||||
console.log('code line-56 \n\r😀 scaleList.value:\n\r',scaleList.value);
|
|
||||||
for (let i = separatedNumber.value.length - 1; i >= 0; i--) {
|
for (let i = separatedNumber.value.length - 1; i >= 0; i--) {
|
||||||
scaleList.value[i] = scaleList.value[i + 1] - separatedNumber.value[i].count
|
scaleList.value[i] = scaleList.value[i + 1] - separatedNumber.value[i].count
|
||||||
}
|
}
|
||||||
if(scaleList.value[0]!==0){
|
if(scaleList.value[0]!==0){
|
||||||
scaleList.value.unshift(0)
|
scaleList.value.unshift(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('code line-56 \n\r😀 scaleList.value:\n\r',scaleList.value);
|
|
||||||
})
|
})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 阻止esc事件
|
// 阻止esc事件
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
<script setup lang='ts'>
|
|
||||||
import { Separate } from '@/types/storeType'
|
|
||||||
import { ref, onMounted, watch, toRefs } from 'vue';
|
|
||||||
const props = defineProps({
|
|
||||||
totalNumber: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
separatedNumber: {
|
|
||||||
type: Array<Separate>,
|
|
||||||
default: []
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const separatedNumberRef = ref()
|
|
||||||
const { separatedNumber, totalNumber } = toRefs(props)
|
|
||||||
const scaleList = ref<number[]>([])
|
|
||||||
const openEdit = () => {
|
|
||||||
console.log('openedit',separatedNumberRef.value)
|
|
||||||
separatedNumberRef.value.showModal()
|
|
||||||
}
|
|
||||||
|
|
||||||
const addScale = (item: number) => {
|
|
||||||
if (scaleList.value.includes(item)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
scaleList.value.push(item)
|
|
||||||
scaleList.value.sort((a, b) => a - b)
|
|
||||||
}
|
|
||||||
const delScale = (item: number) => {
|
|
||||||
if (!scaleList.value.includes(item)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
scaleList.value.splice(scaleList.value.indexOf(item), 1)
|
|
||||||
}
|
|
||||||
watch(scaleList, (val: number[]) => {
|
|
||||||
separatedNumber.value = []
|
|
||||||
for (let i = 1; i < scaleList.value.length; i++) {
|
|
||||||
separatedNumber.value[i - 1] = {
|
|
||||||
id: i.toString(),
|
|
||||||
isUsed: false,
|
|
||||||
num: val[i]-val[i-1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, { deep: true })
|
|
||||||
onMounted(() => {
|
|
||||||
scaleList.value = new Array(separatedNumber.value.length + 1).fill(totalNumber.value)
|
|
||||||
for (let i = separatedNumber.value.length - 1; i >= 0; i--) {
|
|
||||||
scaleList.value[i] = scaleList.value[i + 1] - separatedNumber.value[i].num
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<ul class="flex flex-wrap w-full h-full gap-1 cursor-pointer" @click="openEdit">
|
|
||||||
<li class="flex items-center justify-center w-8 h-8 bg-slate-900/60 separated" v-for="item in separatedNumber"
|
|
||||||
:key="item.id">
|
|
||||||
<span>{{ item.num }}</span>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<dialog id="my_modal_1" ref="separatedNumberRef" class="z-50 overflow-hidden border-none modal">
|
|
||||||
<div class="overflow-hidden modal-box">
|
|
||||||
<h3 class="pb-12 text-lg font-bold">提示!</h3>
|
|
||||||
<div class="flex justify-between px-3 text-center separated-number">
|
|
||||||
<div v-for="item in props.totalNumber" :key="item"
|
|
||||||
class="relative flex flex-col items-center cursor-pointer">
|
|
||||||
<div class="absolute mb-12 text-center tooltip -top-5 hover:text-lg" data-tip="左键切割右键取消"
|
|
||||||
@click.left="addScale(item)" @click.right.prevent="delScale(item)">
|
|
||||||
<span> {{ item }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="text-center" :class="scaleList.includes(item) ? 'text-red-500' : ''">|</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-action">
|
|
||||||
<form method="dialog">
|
|
||||||
<!-- if there is a button in form, it will close the modal -->
|
|
||||||
<button class="btn">退出</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
|
||||||
.separated-number {
|
|
||||||
border-bottom: 1px solid;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,24 +1,9 @@
|
|||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import NumberSeparate from '@/components/NumberSeparate/index.vue'
|
|
||||||
import {ref} from 'vue'
|
|
||||||
|
|
||||||
const total=ref(12)
|
|
||||||
const sep=ref([
|
|
||||||
{id:'0',num:3,isUsed:false},
|
|
||||||
{id:'1',num:4,isUsed:false},
|
|
||||||
{id:'2',num:2,isUsed:false},
|
|
||||||
{id:'3',num:3,isUsed:false},
|
|
||||||
])
|
|
||||||
|
|
||||||
const printPoo=()=>{
|
|
||||||
console.log(sep.value)
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<NumberSeparate :totalNumber="total" :separatedNumber="sep"></NumberSeparate>
|
<button class="btn btn-error">打印</button>
|
||||||
<button class="btn btn-error" @click="printPoo">打印</button>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user