修改样式,修改逻辑
This commit is contained in:
@ -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) {
|
||||
|
@ -124,6 +124,7 @@ export default {
|
||||
text: `${data.name}营养统计`,
|
||||
},
|
||||
tooltip: {
|
||||
position: 'right',
|
||||
trigger: "item",
|
||||
appendToBody: true,
|
||||
formatter: (params) => {
|
||||
|
@ -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"]),
|
||||
},
|
||||
|
Reference in New Issue
Block a user