修改样式,修改逻辑

This commit is contained in:
huangdeliang
2021-02-24 18:20:45 +08:00
parent 13727e8d39
commit 31088215b5
23 changed files with 423 additions and 216 deletions

View File

@ -4,9 +4,11 @@
<script>
import echarts from "echarts";
import VueScrollTo from "vue-scrollto";
require("@/utils/echarts/myShine");
import resize from "@/views/dashboard/mixins/resize";
import { createNamespacedHelpers } from "vuex";
const { mapMutations } = createNamespacedHelpers("recipes");
const animationDuration = 6000;
export default {
@ -55,8 +57,10 @@ export default {
// console.log("updated");
},
methods: {
...mapMutations(["setCurrentDay"]),
initChart() {
this.chart = echarts.init(this.$el, "myShine");
this.chart.on("click", this.handleOnClick);
this.updateChart(this.data.length > 0 ? this.data : {});
},
updateChart(source) {
@ -134,6 +138,14 @@ export default {
})),
});
},
handleOnClick(params) {
// console.log(params);
const { dataIndex } = params;
this.setCurrentDay({ currentDay: dataIndex });
VueScrollTo.scrollTo(`#recipes${dataIndex}`, 500, {
container: "#recipes_content",
});
},
},
watch: {
data(newVal, oldVal) {

View File

@ -124,6 +124,7 @@ export default {
text: `${data.name}营养统计`,
},
tooltip: {
position: 'right',
trigger: "item",
appendToBody: true,
formatter: (params) => {

View File

@ -60,7 +60,12 @@ export default {
this.$emit("update:collapse", !this.collapse);
},
handleOnSave() {
this.saveRecipes();
this.saveRecipes({
callback: (query) => {
console.log(query);
this.$router.replace({ path: "/recipes/build", query });
},
});
},
...mapActions(["saveRecipes"]),
},