Commit 74e95069 by 李伟康

修改样式

1 parent 9a0d5500
......@@ -97,7 +97,6 @@ img {
.van-dropdown-menu__title {
color: #545454 !important;
font-size: 16px;
&::after {
display: none;
}
......@@ -107,10 +106,12 @@ img {
.attachment {
.van-dropdown-menu__bar {
.van-dropdown-menu__title {
color: #5F5F5F !important;
font-size: 12px;
}
.van-dropdown-menu__title--active {
color: var(--themeColor) !important;
}
}
}
\ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 102px 64px;}
.icon-down { width: 12px; height: 12px; background-position: -84px -28px;}
.icon-gift-del { width: 18px; height: 18px; background-position: -84px 0px;}
.sprite-icon { background-image: url(../images/sprite.png);background-size: 105px 86px;}
.icon-down { width: 12px; height: 12px; background-position: 0px -74px;}
.icon-gift-del { width: 18px; height: 18px; background-position: -84px -30px;}
.icon-menu { width: 22px; height: 20px; background-position: 0px -44px;}
.icon-PYQ { width: 21px; height: 20px; background-position: -32px -44px;}
.icon-PYQ { width: 21px; height: 20px; background-position: -84px 0px;}
.icon-pdf { width: 32px; height: 34px; background-position: 0px 0px;}
.icon-link { width: 32px; height: 32px; background-position: -42px 0px;}
.icon-eye { width: 13px; height: 8px; background-position: -84px -50px;}
.icon-send { width: 10px; height: 10px; background-position: -63px -44px;}
\ No newline at end of file
.icon-eye { width: 13px; height: 8px; background-position: -22px -74px;}
.icon-send { width: 10px; height: 10px; background-position: -64px -44px;}
.icon-menu-active { width: 22px; height: 20px; background-position: -32px -44px;}
\ No newline at end of file

8.3 KB | W: | H:

9.32 KB | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template>
<van-dropdown-menu class="dropdown-menu">
<van-dropdown-item ref="menu" teleport="body">
<van-dropdown-item
ref="menu"
teleport="body"
>
<template #title>
<div class="sprite-icon icon-menu-active"></div>
<div class="sprite-icon icon-menu"></div>
</template>
<menu-checkbox />
<menu-checkbox
:single="single"
@confirm="confirm"
:title="title"
/>
</van-dropdown-item>
</van-dropdown-menu>
</template>
......@@ -15,16 +23,22 @@ export default {
components: { MenuCheckbox },
name: 'DropdownMenu',
props: {
single: Boolean,
title: String
},
data () {
return {
test: false,
}
},
mounted () { },
mounted () {
},
methods: {
close () {
this.$refs.menu.toggle()
// this.$refs.menu.toggle()
},
confirm (e) {
this.$emit('confirm', e)
}
}
......@@ -36,6 +50,20 @@ export default {
/deep/.van-dropdown-menu__bar {
width: 44px;
height: 44px !important;
.sprite-icon{
transition: all .25s;
}
.icon-menu-active {
display: none;
}
.van-dropdown-menu__title--active {
.icon-menu-active {
display: block;
}
.icon-menu {
display: none;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="menu-checkbox">
<div class="menu-box">
<div class="menu-title">业务类型:</div>
<div class="menu-title">{{title}}:</div>
<div class="menu-grid">
<template v-for="(i,index) in list">
<div
class="item text-center"
:class="['item text-center',{'active':i.active}]"
:key="index"
@click="choose(i)"
@click="choose(i,index)"
> {{i.text}}</div>
</template>
</div>
</div>
<div class="menu-btn-box">
<van-button
block
round
@click="close"
>
取消
</van-button>
<template v-if="showReset">
<van-button
block
round
@click="reset"
>
重置
</van-button>
</template>
<template v-else>
<van-button
block
round
@click="close"
>
取消
</van-button>
</template>
<van-button
block
round
......@@ -35,8 +46,13 @@
<script type='text/ecmascript-6'>
export default {
name: 'MenuCheckbox',
props: {
single: Boolean,
title: String
},
data () {
return {
showReset: false,
list: [
{
text: '全部',
......@@ -44,20 +60,27 @@ export default {
active: true
},
{
text: '好借好还',
value: '2'
text: '真滴C',
value: 2,
active: false
},
{
text: '社交恐惧',
value: '3'
text: '咦哦啊',
value: 3,
active: false
},
{
text: '随时随地发',
value: '4'
text: '两段蛙跳',
value: 4,
active: false
},
{
text: '天很反感',
value: '6'
text: '葫芦给',
value: 5,
active: false
}
]
}
......@@ -65,7 +88,47 @@ export default {
mounted () {
},
methods: {
choose (e, index) {
let { list, single, showReset } = this
if (single || !e.value) {
list.map(i => i.active = false)
list[index].active = true
} else {
if (list[0].active) list[0].active = false
list[index].active = !e.active
this.check()
}
if (!showReset) this.showReset = true
},
check () {
let { list, single } = this
if (!single) {
try {
list.map(e => { if (e.active) throw false })
} catch (error) {
return
}
}
this.reset()
},
reset () {
let { list } = this
list.map(i => i.active = false)
list[0].active = true
this.showReset = false
},
confirm () {
let { list } = this
let chooseList = []
try {
list.map(e => {
if (!e.value && e.active) throw e
if (e.active) chooseList.push(e)
})
} catch (e) {
chooseList = []
}
this.$emit('confirm', chooseList)
this.close()
},
close () {
......@@ -86,7 +149,7 @@ export default {
display: flex;
flex-wrap: wrap;
gap: 16px;
padding: 12px 23px;
padding: 12px 0 12px 23px;
.item {
height: 26px;
border-radius: 4px;
......@@ -94,6 +157,7 @@ export default {
padding: 0 12px;
color: #666;
font-size: 14px;
transition: all .25s;
}
.active {
border-color: var(--themeColor);
......
......@@ -21,7 +21,11 @@
</van-dropdown-menu>
</template>
<template v-if="showMenu">
<dropdown-menu></dropdown-menu>
<dropdown-menu
@confirm="onEmit($event,'menuSelect')"
:single="single"
:title="title"
></dropdown-menu>
</template>
</div>
</template>
......@@ -49,10 +53,13 @@ export default {
default: 30
},
showMenu: Boolean,
option:{
type:Array,
default:() => []
}
option: {
type: Array,
default: () => []
},
single: Boolean,
title: String
},
data () {
return {
......
......@@ -43,7 +43,7 @@ fetchConfig(!isMock).then(res => {
// 设置 js中可以访问 $cdn
Vue.use(cfg)
window.$fetchConfig = res
if (res.vconsole) new VConsole()
// if (res.vconsole) new VConsole()
/**登录过期 重新登录 */
window.reLogin = () => {
......
......@@ -7,7 +7,7 @@
>
</tab>
<dropdown-menu class="menu"></dropdown-menu>
<dropdown-menu class="menu" title="业务类型"></dropdown-menu>
</div>
<search-box
@search="search"
......
......@@ -5,20 +5,23 @@
:keyword="keyword"
:showDropdown="false"
showMenu
single
placeholder="输入关键词"
@menuSelect="menuSelect"
title="素材组"
></search-box>
<van-dropdown-menu
active-color="#3975C6"
class="tab-menu"
class="tab-menu attachment"
>
<van-dropdown-item ref="menu">
<template #title>
<div class="menu-title flex">
全部
{{businessText}}
<div class="sprite-icon icon-down"></div>
</div>
</template>
<menu-checkbox />
<menu-checkbox @confirm="confirm" title="业务类型" />
</van-dropdown-item>
<van-dropdown-item
:options="option"
......@@ -72,12 +75,28 @@ export default {
flag: true,
list: new Array(10).fill('121'),
total: 0,
pageNum: 1
pageNum: 1,
businessText: '全部'
}
},
mounted () {
},
methods: {
confirm (chooseList) {
console.log(chooseList)
if (chooseList.length) {
let text = []
chooseList.map(e => {
text.push(e.text)
})
this.businessText = `${text.join(',').substring(0, 5)}...`
} else {
this.businessText = '全部'
}
},
menuSelect(e){
console.log(e)
},
search (e) {
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!