Commit 86e88337 by 胡悦

修复

1 parent 4e8daedc
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-05 15:11:53 * @Date: 2023-07-05 15:11:53
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-14 16:34:42 * @LastEditTime: 2023-07-14 17:03:43
--> -->
<template> <template>
<div v-click-outside="handleClickOutside" @mouseleave="handleMouseLeave" v-show="isShow" class="select-box" :style="{'width': boxWidth}"> <div v-click-outside="handleClickOutside" @mouseleave="handleMouseLeave" v-show="isShow" class="select-box" :style="{'width': boxWidth}">
...@@ -73,10 +73,17 @@ export default { ...@@ -73,10 +73,17 @@ export default {
} }
}, },
watch: { watch: {
'defaultValue': {
handler(newVal) {
console.log(newVal)
}
}
}, },
mounted() { mounted() {
const { valueName, isObject, dataList, defaultValue } = this const { valueName, isObject, dataList, defaultValue } = this
console.log(defaultValue)
this.value = defaultValue || (isObject ? dataList[0][valueName] : dataList[0]) this.value = defaultValue || (isObject ? dataList[0][valueName] : dataList[0])
console.log(this.value)
}, },
methods: { methods: {
select(item) { select(item) {
......
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-05 10:35:43 * @Date: 2023-07-05 10:35:43
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-14 10:57:28 * @LastEditTime: 2023-07-14 17:07:42
--> -->
<template> <template>
<div class="view-date">统计年份: <div class="view-date">统计年份:
<div class="year-plugin"> <div class="year-plugin">
<div class="year" @click.stop="switchYear"> <div class="year" @click.stop="switchYear">
{{year}} {{$store.state.app.solarYear}}
<img class="arrow-down" src="@/assets/images/arrow-down.png" alt=""> <img class="arrow-down" src="@/assets/images/arrow-down.png" alt="">
</div> </div>
<SelectBox :isShow="isShow" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'8.61vw'" @selectVal="selectVal"></SelectBox> <SelectBox :isShow="isShow" :defaultValue="$store.state.app.solarYear" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'8.61vw'" @selectVal="selectVal"></SelectBox>
<!-- <div v-show="isShow" class="select-year"> <!-- <div v-show="isShow" class="select-year">
<div class="year-item" :class="year == item ? 'active' : ''" v-for="(item,index) in dataList" :key="index" @click.s="selectYear(item)">{{item}}</div> <div class="year-item" :class="year == item ? 'active' : ''" v-for="(item,index) in dataList" :key="index" @click.s="selectYear(item)">{{item}}</div>
</div> --> </div> -->
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import datas from '@/utils/data' import datas from '@/utils/data'
import { mapActions } from 'vuex'
export default { export default {
name: 'ViewDate', name: 'ViewDate',
props: { props: {
...@@ -34,15 +35,17 @@ export default { ...@@ -34,15 +35,17 @@ export default {
} }
}, },
mounted() { mounted() {
this.year = this.dataList[0] // this.year = this.$store.state.app.solarYear
}, },
methods: { methods: {
...mapActions(['setSolarYear']),
switchYear() { switchYear() {
this.isShow = !this.isShow this.isShow = !this.isShow
}, },
selectVal(val) { selectVal(val) {
this.year = val // this.year = val
this.$emit('yearValue', val) // this.$emit('yearValue', val)
this.setSolarYear(val)
this.switchYear() this.switchYear()
}, },
clickOutside() { clickOutside() {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-04 13:56:33 * @Date: 2023-07-04 13:56:33
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-13 17:43:57 * @LastEditTime: 2023-07-14 17:08:05
--> -->
<template> <template>
<div class="view-content"> <div class="view-content">
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
<script> <script>
import ContentLeft from '../solar/ContentLeft' import ContentLeft from '../solar/ContentLeft'
import ContentRight from '../solar/ContentRight.vue' import ContentRight from '../solar/ContentRight.vue'
import { mapActions } from 'vuex'
export default { export default {
name: 'ViewSolar', name: 'ViewSolar',
components: { components: {
...@@ -39,10 +38,6 @@ export default { ...@@ -39,10 +38,6 @@ export default {
}) })
}, },
methods: { methods: {
...mapActions(['setSolarYear']),
yearValue(val) {
this.setSolarYear(val)
}
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!