dpzvc3-ui 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dpzvc3.esm.js +722 -718
- package/dist/dpzvc3.esm.js.map +1 -1
- package/dist/dpzvc3.esm.min.js +1 -1
- package/dist/dpzvc3.esm.min.js.map +1 -1
- package/dist/dpzvc3.js +230 -217
- package/dist/dpzvc3.js.map +1 -1
- package/dist/dpzvc3.min.js +1 -1
- package/dist/dpzvc3.min.js.map +1 -1
- package/dist-prod/91.e2fdec39667928bf57b9.js +3 -0
- package/dist-prod/{91.9d79b442ec3131707419.js.map → 91.e2fdec39667928bf57b9.js.map} +1 -1
- package/dist-prod/{cellswipe.53b0178e4638c201dcf1.chunk.js → cellswipe.04240414bed39e28e7b9.chunk.js} +2 -2
- package/dist-prod/{cellswipe.53b0178e4638c201dcf1.chunk.js.map → cellswipe.04240414bed39e28e7b9.chunk.js.map} +1 -1
- package/dist-prod/index.html +1 -1
- package/dist-prod/main.bcc12e5051993020bbea.js +2 -0
- package/dist-prod/main.bcc12e5051993020bbea.js.map +1 -0
- package/dist-prod/slidebar.d7ad5de495550613661f.chunk.js +2 -0
- package/dist-prod/slidebar.d7ad5de495550613661f.chunk.js.map +1 -0
- package/package.json +1 -1
- package/src/components/action-sheet/actionSheet.vue +8 -7
- package/src/components/app.vue +3 -5
- package/src/components/badge/badge.vue +3 -3
- package/src/components/cell/cell.vue +25 -5
- package/src/components/cell-swipe/cell-swipe.vue +5 -6
- package/src/components/header/header.vue +5 -4
- package/src/components/modal/modal.vue +3 -3
- package/src/components/popup/popup.vue +3 -3
- package/src/components/radioBox/radiobox.vue +5 -4
- package/src/components/slideBar/slideBar.vue +23 -5
- package/src/views/SlideBar.vue +5 -2
- package/dist-prod/91.9d79b442ec3131707419.js +0 -3
- package/dist-prod/main.500d6bc40855d284c027.js +0 -2
- package/dist-prod/main.500d6bc40855d284c027.js.map +0 -1
- package/dist-prod/slidebar.3d3f48a631f03a2210c9.chunk.js +0 -2
- package/dist-prod/slidebar.3d3f48a631f03a2210c9.chunk.js.map +0 -1
- /package/dist-prod/{91.9d79b442ec3131707419.js.LICENSE.txt → 91.e2fdec39667928bf57b9.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(self.webpackChunkdpzvc3_ui=self.webpackChunkdpzvc3_ui||[]).push([[13],{2684(e,n,i){var t=i(3321);t.__esModule&&(t=t.default),"string"==typeof t&&(t=[[e.id,t,""]]),t.locals&&(e.exports=t.locals);(0,i(534).A)("948cae42",t,!0,{})},3321(e,n,i){"use strict";i.r(n),i.d(n,{default:()=>s});var t=i(1354),l=i.n(t),d=i(6314),r=i.n(d)()(l());r.push([e.id,".SlideBar[data-v-67055e32] {\n width: 100%;\n}\n/*# sourceMappingURL=SlideBar.css.map */","",{version:3,sources:["webpack://./SlideBar.vue","webpack://./src/views/SlideBar.vue"],names:[],mappings:"AACA;EACE,WAAA;ACAF;AACA,uCAAuC",sourcesContent:["\n.SlideBar {\n width: 100%;\n}\n",".SlideBar {\n width: 100%;\n}\n/*# sourceMappingURL=SlideBar.css.map */"],sourceRoot:""}]);const s=r},3542(e,n,i){"use strict";i.r(n),i.d(n,{default:()=>s});var t=i(5458),l=i(1425),d={class:"SlideBar"};const r=(0,l.pM)({name:"ViewSlideBar",setup:function(){return{items:(0,l.KR)([{name:"选项一"},{name:"选项二"},{name:"选项三"}]),index:(0,l.KR)(1),changeIndex:function(e){}}}});i(2684);const s=(0,i(6262).A)(r,[["render",function(e,n,i,r,s,a){var o=(0,l.g2)("Slide-bar",!0);return(0,l.uX)(),(0,l.CE)("div",d,[(0,l.bF)(o,{list:e.items,flex:!1,index:e.index,height:"100%","scroll-height":"50px","is-fixed-header":!0,onOnChange:e.changeIndex},{"slot-item-0":(0,l.k6)(function(){return(0,t.A)(n[0]||(n[0]=[(0,l.Lk)("div",{style:{height:"100%",flex:"1",background:"red",overflow:"scroll"}},[(0,l.Lk)("div",{style:{height:"40px",width:"100%","background-color":"blue"}}),(0,l.Lk)("div",{style:{height:"40px",width:"100%","background-color":"blue"}}),(0,l.Lk)("div",{style:{height:"40px",width:"100%","background-color":"blue"}}),(0,l.Lk)("div",{style:{height:"40px",width:"100%","background-color":"blue"}}),(0,l.Lk)("div",{style:{height:"40px",width:"100%","background-color":"blue"}})],-1)]))}),"slot-item-1":(0,l.k6)(function(){return(0,t.A)(n[1]||(n[1]=[(0,l.Lk)("div",{style:{height:"200px",flex:"1",background:"yellow"}},null,-1)]))}),"slot-item-2":(0,l.k6)(function(){return(0,t.A)(n[2]||(n[2]=[(0,l.Lk)("div",{style:{height:"200px",flex:"1",background:"black"}},null,-1)]))}),_:1},8,["list","index","onOnChange"])])}],["__scopeId","data-v-67055e32"]])}}]);
|
|
2
|
+
//# sourceMappingURL=slidebar.d7ad5de495550613661f.chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slidebar.d7ad5de495550613661f.chunk.js","mappings":"oFAGA,IAAIA,EAAU,EAAQ,MACnBA,EAAQC,aAAYD,EAAUA,EAAQE,SACnB,iBAAZF,IAAsBA,EAAU,CAAC,CAACG,EAAOC,GAAIJ,EAAS,MAC7DA,EAAQK,SAAQF,EAAOG,QAAUN,EAAQK,SAG/BE,EADH,UACO,WAAYP,GAAS,EAAM,CAAC,E,0FCNzCQ,E,MAA0B,GAA4B,KAE1DA,EAAwBC,KAAK,CAACN,EAAOC,GAAI,4FAGE,GAAG,CAAC,QAAU,EAAE,QAAU,CAAC,2BAA2B,sCAAsC,MAAQ,GAAG,SAAW,kCAAkC,eAAiB,CAAC,qCAAqC,4EAA4E,WAAa,MAE/U,S,oFCTOM,MAAM,YAmCb,SAAeC,EAAAA,EAAAA,IAAgB,CAC7BC,KAAM,eACNC,MAAI,WAUF,MAAO,CAAEC,OATKC,EAAAA,EAAAA,IAAI,CAChB,CAAEH,KAAM,OACR,CAAEA,KAAM,OACR,CAAEA,KAAM,SAMMI,OAJFD,EAAAA,EAAAA,IAAI,GAIKE,YAHH,SAACD,GAErB,EAEF,I,QC1CF,MAEA,GAFiC,E,QAAA,GAAgB,EAAQ,CAAC,CAAC,S,uEDNzDE,EAAAA,EAAAA,IA6BM,MA7BNC,EA6BM,EA5BJC,EAAAA,EAAAA,IA2BYC,EAAA,CA1BTC,KAAMC,EAAAT,MACNU,MAAM,EACNR,MAAOO,EAAAP,MACRS,OAAO,OACP,gBAAc,OACb,mBAAiB,EACjBC,WAAWH,EAAAN,a,CAGD,eAAWU,EAAAA,EAAAA,IACpB,kBAAAC,EAAAA,EAAAA,GAMMC,EAAA,KAAAA,EAAA,KANNC,EAAAA,EAAAA,IAMM,OANDC,MAAA,6DAA+D,EAClED,EAAAA,EAAAA,IAAkE,OAA7DC,MAAA,0DACLD,EAAAA,EAAAA,IAAkE,OAA7DC,MAAA,0DACLD,EAAAA,EAAAA,IAAkE,OAA7DC,MAAA,0DACLD,EAAAA,EAAAA,IAAkE,OAA7DC,MAAA,0DACLD,EAAAA,EAAAA,IAAkE,OAA7DC,MAAA,2D,QAIE,eAAWJ,EAAAA,EAAAA,IACpB,kBAAAC,EAAAA,EAAAA,GAAwDC,EAAA,KAAAA,EAAA,KAAxDC,EAAAA,EAAAA,IAAwD,OAAnDC,MAAA,+CAAgD,W,GAG5C,eAAWJ,EAAAA,EAAAA,IACpB,kBAAAC,EAAAA,EAAAA,GAAuDC,EAAA,KAAAA,EAAA,KAAvDC,EAAAA,EAAAA,IAAuD,OAAlDC,MAAA,8CAA+C,W,6CCpBgB,CAAC,YAAY,oB","sources":["webpack://dpzvc3-ui/./src/views/SlideBar.vue?1f42","webpack://dpzvc3-ui/./src/views/SlideBar.vue?05d1","webpack://dpzvc3-ui/./src/views/SlideBar.vue","webpack://dpzvc3-ui/./src/views/SlideBar.vue?6fd3"],"sourcesContent":["// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = require(\"!!../../node_modules/css-loader/dist/cjs.js!../../node_modules/vue-loader/dist/stylePostLoader.js!../../node_modules/postcss-loader/dist/cjs.js!../../node_modules/less-loader/dist/cjs.js!../../node_modules/vue-loader/dist/index.js??ruleSet[1].rules[7].use[0]!./SlideBar.vue?vue&type=style&index=0&id=67055e32&lang=less&scoped=true\");\nif(content.__esModule) content = content.default;\nif(typeof content === 'string') content = [[module.id, content, '']];\nif(content.locals) module.exports = content.locals;\n// add the styles to the DOM\nvar add = require(\"!../../node_modules/vue-style-loader/lib/addStylesClient.js\").default\nvar update = add(\"948cae42\", content, true, {});","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.SlideBar[data-v-67055e32] {\n width: 100%;\n}\n/*# sourceMappingURL=SlideBar.css.map */`, \"\",{\"version\":3,\"sources\":[\"webpack://./SlideBar.vue\",\"webpack://./src/views/SlideBar.vue\"],\"names\":[],\"mappings\":\"AACA;EACE,WAAA;ACAF;AACA,uCAAuC\",\"sourcesContent\":[\"\\n.SlideBar {\\n width: 100%;\\n}\\n\",\".SlideBar {\\n width: 100%;\\n}\\n/*# sourceMappingURL=SlideBar.css.map */\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","<template>\n <div class=\"SlideBar\">\n <Slide-bar\n :list=\"items\"\n :flex=\"false\"\n :index=\"index\"\n height=\"100%\"\n scroll-height=\"50px\"\n :is-fixed-header=\"true\"\n @on-change=\"changeIndex\"\n >\n <!-- 具名插槽语法 Vue3 -->\n <template #slot-item-0>\n <div style=\"height:100%; flex: 1; background:red; overflow: scroll;\">\n <div style=\"height: 40px; width: 100%; background-color: blue;\" />\n <div style=\"height: 40px; width: 100%; background-color: blue;\" />\n <div style=\"height: 40px; width: 100%; background-color: blue;\" />\n <div style=\"height: 40px; width: 100%; background-color: blue;\" />\n <div style=\"height: 40px; width: 100%; background-color: blue;\" />\n </div>\n </template>\n\n <template #slot-item-1>\n <div style=\"height:200px; flex:1; background:yellow;\" />\n </template>\n\n <template #slot-item-2>\n <div style=\"height:200px; flex:1; background:black;\" />\n </template>\n </Slide-bar>\n </div>\n</template>\n\n<script>\nimport { defineComponent, ref } from 'vue'\n\nexport default defineComponent({\n name: 'ViewSlideBar',\n setup () {\n const items = ref([\n { name: '选项一' },\n { name: '选项二' },\n { name: '选项三' }\n ])\n const index = ref(1)\n const changeIndex = (index) => {\n console.log(index)\n }\n return { items, index, changeIndex }\n }\n})\n</script>\n\n<style lang=\"less\" scoped>\n.SlideBar {\n width: 100%;\n}\n</style>\n","import { render } from \"./SlideBar.vue?vue&type=template&id=67055e32&scoped=true\"\nimport script from \"./SlideBar.vue?vue&type=script&lang=js\"\nexport * from \"./SlideBar.vue?vue&type=script&lang=js\"\n\nimport \"./SlideBar.vue?vue&type=style&index=0&id=67055e32&lang=less&scoped=true\"\n\nimport exportComponent from \"../../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render],['__scopeId',\"data-v-67055e32\"]])\n\nexport default __exports__"],"names":["content","__esModule","default","module","id","locals","exports","add","___CSS_LOADER_EXPORT___","push","class","defineComponent","name","setup","items","ref","index","changeIndex","_createElementBlock","_hoisted_1","_createVNode","_component_Slide_bar","list","_ctx","flex","height","onOnChange","_withCtx","_toConsumableArray","_cache","_createElementVNode","style"],"ignoreList":[],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
</template>
|
|
29
29
|
|
|
30
30
|
<script>
|
|
31
|
-
import { ref, computed, watch } from 'vue'
|
|
31
|
+
import { ref, computed, watch, defineComponent } from 'vue'
|
|
32
32
|
import Popup from '../popup'
|
|
33
33
|
|
|
34
34
|
const prefixCls = 'dpzvc3-actionSheet'
|
|
35
35
|
|
|
36
|
-
export default {
|
|
36
|
+
export default defineComponent({
|
|
37
37
|
name: 'ActionSheet',
|
|
38
38
|
components: { Popup },
|
|
39
39
|
props: {
|
|
@@ -61,9 +61,9 @@ export default {
|
|
|
61
61
|
})
|
|
62
62
|
|
|
63
63
|
// 监听 visible 改变,通知父组件
|
|
64
|
-
watch(visible, (val) => {
|
|
65
|
-
|
|
66
|
-
})
|
|
64
|
+
// watch(visible, (val) => {
|
|
65
|
+
// emit('update:modelValue', val)
|
|
66
|
+
// })
|
|
67
67
|
|
|
68
68
|
// 样式类
|
|
69
69
|
const classes = computed(() => [prefixCls])
|
|
@@ -76,7 +76,8 @@ export default {
|
|
|
76
76
|
if (item.onClick && typeof item.onClick === 'function') {
|
|
77
77
|
item.onClick(item, index)
|
|
78
78
|
}
|
|
79
|
-
visible.value = false
|
|
79
|
+
// visible.value = false
|
|
80
|
+
emit('update:modelValue', false)
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
return {
|
|
@@ -89,5 +90,5 @@ export default {
|
|
|
89
90
|
emit: emitAction
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
}
|
|
93
|
+
})
|
|
93
94
|
</script>
|
package/src/components/app.vue
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script>
|
|
12
|
-
import { computed, ref, watch } from 'vue'
|
|
12
|
+
import { computed, ref, watch, defineComponent } from 'vue'
|
|
13
13
|
|
|
14
14
|
const prefixCls = 'dpzvc3-badge'
|
|
15
15
|
|
|
16
|
-
export default {
|
|
16
|
+
export default defineComponent({
|
|
17
17
|
name: 'Dpzvc3Badge',
|
|
18
18
|
props: {
|
|
19
19
|
type: {
|
|
@@ -76,5 +76,5 @@ export default {
|
|
|
76
76
|
displayCount
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
})
|
|
80
80
|
</script>
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
:href="toLink"
|
|
4
4
|
:class="classes"
|
|
5
5
|
@click.prevent="handleClick"
|
|
6
|
+
@touchstart="cellTouchStart"
|
|
7
|
+
@touchmove="cellTouchMove"
|
|
8
|
+
@touchend="cellTouchEnd"
|
|
6
9
|
>
|
|
7
10
|
<span
|
|
8
11
|
v-if="hasMask"
|
|
@@ -35,12 +38,12 @@
|
|
|
35
38
|
</template>
|
|
36
39
|
|
|
37
40
|
<script>
|
|
38
|
-
import { computed } from 'vue'
|
|
41
|
+
import { computed, defineComponent } from 'vue'
|
|
39
42
|
import { useRouter } from 'vue-router'
|
|
40
43
|
|
|
41
44
|
const prefixCls = 'dpzvc3-cell'
|
|
42
45
|
|
|
43
|
-
export default {
|
|
46
|
+
export default defineComponent({
|
|
44
47
|
name: 'Dpzvc3Cell',
|
|
45
48
|
props: {
|
|
46
49
|
title: String,
|
|
@@ -49,6 +52,7 @@ export default {
|
|
|
49
52
|
link: String,
|
|
50
53
|
hasMask: Boolean
|
|
51
54
|
},
|
|
55
|
+
emits: ['touchstart', 'touchmove', 'touchend', 'click'],
|
|
52
56
|
setup (props, { emit }) {
|
|
53
57
|
const router = useRouter()
|
|
54
58
|
|
|
@@ -72,7 +76,20 @@ export default {
|
|
|
72
76
|
|
|
73
77
|
// 点击跳转
|
|
74
78
|
const handleClick = (e) => {
|
|
75
|
-
if (props.link) router.push(props.link)
|
|
79
|
+
if (props.link) { router.push(props.link) } else {
|
|
80
|
+
emit('click', e)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 定义touchstart,touchmove,touchend事件
|
|
85
|
+
const cellTouchStart = (e) => {
|
|
86
|
+
emit('touchstart', e)
|
|
87
|
+
}
|
|
88
|
+
const cellTouchMove = (e) => {
|
|
89
|
+
emit('touchmove', e)
|
|
90
|
+
}
|
|
91
|
+
const cellTouchEnd = (e) => {
|
|
92
|
+
emit('touchend', e)
|
|
76
93
|
}
|
|
77
94
|
|
|
78
95
|
return {
|
|
@@ -86,8 +103,11 @@ export default {
|
|
|
86
103
|
valueClass,
|
|
87
104
|
labelClass,
|
|
88
105
|
handleClick,
|
|
89
|
-
emit
|
|
106
|
+
emit,
|
|
107
|
+
cellTouchStart,
|
|
108
|
+
cellTouchMove,
|
|
109
|
+
cellTouchEnd
|
|
90
110
|
}
|
|
91
111
|
}
|
|
92
|
-
}
|
|
112
|
+
})
|
|
93
113
|
</script>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Cell
|
|
3
3
|
ref="cell"
|
|
4
|
-
v-clickoutside:touchstart="swipe"
|
|
5
4
|
:title="title"
|
|
6
5
|
:value="value"
|
|
7
6
|
:label="label"
|
|
@@ -47,14 +46,14 @@
|
|
|
47
46
|
</template>
|
|
48
47
|
|
|
49
48
|
<script>
|
|
50
|
-
import { ref, reactive, onMounted, watch, nextTick } from 'vue'
|
|
49
|
+
import { ref, reactive, onMounted, watch, nextTick, defineComponent } from 'vue'
|
|
51
50
|
import Cell from '../cell'
|
|
52
|
-
import Clickoutside from '../../directives/clickoutside'
|
|
51
|
+
// import Clickoutside from '../../directives/clickoutside'
|
|
53
52
|
|
|
54
|
-
export default {
|
|
53
|
+
export default defineComponent({
|
|
55
54
|
name: 'CellSwipe',
|
|
56
55
|
components: { Cell },
|
|
57
|
-
directives: { Clickoutside },
|
|
56
|
+
// directives: { Clickoutside },
|
|
58
57
|
props: {
|
|
59
58
|
title: String,
|
|
60
59
|
value: {},
|
|
@@ -165,5 +164,5 @@ export default {
|
|
|
165
164
|
onTouchEnd
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
|
-
}
|
|
167
|
+
})
|
|
169
168
|
</script>
|
|
@@ -93,9 +93,9 @@ export default defineComponent({
|
|
|
93
93
|
}
|
|
94
94
|
)
|
|
95
95
|
|
|
96
|
-
watch(visible, val => {
|
|
97
|
-
|
|
98
|
-
})
|
|
96
|
+
// watch(visible, val => {
|
|
97
|
+
// emit('update:modelValue', val)
|
|
98
|
+
// })
|
|
99
99
|
|
|
100
100
|
watch(
|
|
101
101
|
() => props.wechat,
|
|
@@ -107,7 +107,8 @@ export default defineComponent({
|
|
|
107
107
|
/** mounted 逻辑 */
|
|
108
108
|
onMounted(() => {
|
|
109
109
|
if ((isWeixin.value || isPcWeixin.value) && !isWechat.value) {
|
|
110
|
-
visible.value = false
|
|
110
|
+
// visible.value = false
|
|
111
|
+
emit('update:modelValue', false)
|
|
111
112
|
}
|
|
112
113
|
})
|
|
113
114
|
|
|
@@ -66,10 +66,10 @@
|
|
|
66
66
|
</template>
|
|
67
67
|
|
|
68
68
|
<script>
|
|
69
|
-
import { ref, computed, watch } from 'vue'
|
|
69
|
+
import { ref, computed, watch, defineComponent } from 'vue'
|
|
70
70
|
import VButton from '../button'
|
|
71
71
|
|
|
72
|
-
export default {
|
|
72
|
+
export default defineComponent({
|
|
73
73
|
name: 'Dpzvc3Modal',
|
|
74
74
|
components: { VButton },
|
|
75
75
|
props: {
|
|
@@ -134,5 +134,5 @@ export default {
|
|
|
134
134
|
ok
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
}
|
|
137
|
+
})
|
|
138
138
|
</script>
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script>
|
|
24
|
-
import { ref, computed, watch } from 'vue'
|
|
24
|
+
import { ref, computed, watch, defineComponent } from 'vue'
|
|
25
25
|
|
|
26
26
|
const prefixCls = 'dpzvc3-popup'
|
|
27
27
|
|
|
28
|
-
export default {
|
|
28
|
+
export default defineComponent({
|
|
29
29
|
name: 'Dpzvc3Popup',
|
|
30
30
|
props: {
|
|
31
31
|
modelValue: { // Vue 3 v-model 默认绑定
|
|
@@ -87,5 +87,5 @@ export default {
|
|
|
87
87
|
close
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
}
|
|
90
|
+
})
|
|
91
91
|
</script>
|
|
@@ -24,10 +24,10 @@ export default defineComponent({
|
|
|
24
24
|
name: 'RadioBox',
|
|
25
25
|
props: {
|
|
26
26
|
label: { type: [String, Number], required: true },
|
|
27
|
-
|
|
27
|
+
modelValue: { type: Boolean, default: false },
|
|
28
28
|
disable: { type: Boolean, default: false }
|
|
29
29
|
},
|
|
30
|
-
emits: ['update:
|
|
30
|
+
emits: ['update:modelValue', 'on-change'],
|
|
31
31
|
setup (props, { emit }) {
|
|
32
32
|
const slotEl = ref(null)
|
|
33
33
|
const show = ref(true)
|
|
@@ -37,7 +37,7 @@ export default defineComponent({
|
|
|
37
37
|
if (group) {
|
|
38
38
|
return group.currentValue.value === props.label
|
|
39
39
|
} else {
|
|
40
|
-
return props.
|
|
40
|
+
return props.modelValue
|
|
41
41
|
}
|
|
42
42
|
})
|
|
43
43
|
|
|
@@ -59,7 +59,8 @@ export default defineComponent({
|
|
|
59
59
|
if (group) {
|
|
60
60
|
group.change(props.label)
|
|
61
61
|
} else {
|
|
62
|
-
|
|
62
|
+
// console.log(checked, 'ddadda')
|
|
63
|
+
emit('update:modelValue', checked)
|
|
63
64
|
emit('on-change', checked)
|
|
64
65
|
}
|
|
65
66
|
}
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</template>
|
|
57
57
|
|
|
58
58
|
<script>
|
|
59
|
-
import { defineComponent, ref, computed, onMounted, onBeforeUnmount
|
|
59
|
+
import { defineComponent, ref, computed, onMounted, onBeforeUnmount } from 'vue'
|
|
60
60
|
|
|
61
61
|
const prefixCls = 'dpzvc3-slideBar'
|
|
62
62
|
|
|
@@ -93,8 +93,8 @@ export default defineComponent({
|
|
|
93
93
|
const fixed = ref(false)
|
|
94
94
|
|
|
95
95
|
const getItemWidth = computed(() => (isFlex.value ? clientWidth.value / items.value.length : props.childWidth))
|
|
96
|
-
const translateX = computed(() => -startIndex.value * clientWidth.value)
|
|
97
|
-
|
|
96
|
+
// const translateX = computed(() => -startIndex.value * clientWidth.value)
|
|
97
|
+
const translateX = ref(0)
|
|
98
98
|
const classes = computed(() => [prefixCls])
|
|
99
99
|
const headerClasses = computed(() => [prefixCls + '-header', { fixed: fixed.value }])
|
|
100
100
|
const wrapperClasses = computed(() => [
|
|
@@ -121,6 +121,7 @@ export default defineComponent({
|
|
|
121
121
|
function changeBar (index) {
|
|
122
122
|
if (startIndex.value === index) return
|
|
123
123
|
startIndex.value = index
|
|
124
|
+
translateX.value = -startIndex.value * clientWidth.value
|
|
124
125
|
emit('on-change', index)
|
|
125
126
|
}
|
|
126
127
|
|
|
@@ -134,21 +135,35 @@ export default defineComponent({
|
|
|
134
135
|
function onTouchMove (e) {
|
|
135
136
|
const currentX = e.touches[0].clientX
|
|
136
137
|
distance.value = props.distanceIndex ? (currentX - startX.value) / props.distanceIndex : currentX - startX.value
|
|
138
|
+
translateX.value = startTranslateX.value + distance.value
|
|
137
139
|
}
|
|
138
140
|
function onTouchEnd () {
|
|
139
141
|
if (distance.value < 0 && Math.abs(distance.value) > clientWidth.value / 2) {
|
|
140
142
|
slideLeft()
|
|
141
143
|
} else if (distance.value > 0 && Math.abs(distance.value) > clientWidth.value / 2) {
|
|
142
144
|
slideRight()
|
|
145
|
+
} else {
|
|
146
|
+
translateX.value = startTranslateX.value
|
|
143
147
|
}
|
|
144
148
|
dragging.value = false
|
|
145
149
|
}
|
|
146
150
|
function slideLeft () {
|
|
147
|
-
if (startIndex.value
|
|
151
|
+
if (startIndex.value >= maxIndex.value) {
|
|
152
|
+
translateX.value = startTranslateX.value
|
|
153
|
+
} else {
|
|
154
|
+
startIndex.value++
|
|
155
|
+
translateX.value = startTranslateX.value - clientWidth.value
|
|
156
|
+
}
|
|
148
157
|
emit('on-change', startIndex.value)
|
|
149
158
|
}
|
|
150
159
|
function slideRight () {
|
|
151
|
-
if (startIndex.value > 0) startIndex.value--
|
|
160
|
+
// if (startIndex.value > 0) startIndex.value--
|
|
161
|
+
if (startIndex.value <= 0) {
|
|
162
|
+
translateX.value = startTranslateX.value
|
|
163
|
+
} else {
|
|
164
|
+
startIndex.value--
|
|
165
|
+
translateX.value = startTranslateX.value + clientWidth.value
|
|
166
|
+
}
|
|
152
167
|
emit('on-change', startIndex.value)
|
|
153
168
|
}
|
|
154
169
|
|
|
@@ -162,8 +177,11 @@ export default defineComponent({
|
|
|
162
177
|
|
|
163
178
|
onMounted(() => {
|
|
164
179
|
clientWidth.value = header.value.clientWidth
|
|
180
|
+
translateX.value = -startIndex.value * clientWidth.value
|
|
165
181
|
window.addEventListener('resize', onResize)
|
|
182
|
+
onScroll()
|
|
166
183
|
if (props.canDrag && content.value) {
|
|
184
|
+
// console.log(content.value, 'dadsds')
|
|
167
185
|
content.value.addEventListener('touchstart', onTouchStart)
|
|
168
186
|
content.value.addEventListener('touchmove', onTouchMove)
|
|
169
187
|
content.value.addEventListener('touchend', onTouchEnd)
|
package/src/views/SlideBar.vue
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
:list="items"
|
|
5
5
|
:flex="false"
|
|
6
6
|
:index="index"
|
|
7
|
-
:can-drag="false"
|
|
8
7
|
height="100%"
|
|
9
8
|
scroll-height="50px"
|
|
10
9
|
:is-fixed-header="true"
|
|
10
|
+
@on-change="changeIndex"
|
|
11
11
|
>
|
|
12
12
|
<!-- 具名插槽语法 Vue3 -->
|
|
13
13
|
<template #slot-item-0>
|
|
@@ -43,7 +43,10 @@ export default defineComponent({
|
|
|
43
43
|
{ name: '选项三' }
|
|
44
44
|
])
|
|
45
45
|
const index = ref(1)
|
|
46
|
-
|
|
46
|
+
const changeIndex = (index) => {
|
|
47
|
+
console.log(index)
|
|
48
|
+
}
|
|
49
|
+
return { items, index, changeIndex }
|
|
47
50
|
}
|
|
48
51
|
})
|
|
49
52
|
</script>
|