修复html属性的bug!
This commit is contained in:
@@ -18,58 +18,59 @@ import { reactive, onMounted } from "vue";
|
||||
import * as echarts from "echarts";
|
||||
|
||||
export default {
|
||||
name: "ArchievementChartComponent",
|
||||
props: {
|
||||
chartData: {
|
||||
type: Array,
|
||||
require: true,
|
||||
default: () => [],
|
||||
name: "ArchievementChartComponent",
|
||||
props: {
|
||||
chartData: {
|
||||
type: Array,
|
||||
require: true,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
},
|
||||
setup (props)
|
||||
{
|
||||
const ui = reactive({
|
||||
chart_data: props.chartData,
|
||||
});
|
||||
|
||||
// 设置图表
|
||||
const initCharts = () =>
|
||||
setup( props )
|
||||
{
|
||||
const chartDom = document.getElementById("chartWrapper");
|
||||
const myChart = echarts.init(chartDom as HTMLDivElement);
|
||||
const option = {
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二",],
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
data: [200, 400, 600, 800, 1000,],
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: props.chartData,
|
||||
type: "line",
|
||||
},
|
||||
],
|
||||
};
|
||||
const ui = reactive( {
|
||||
} );
|
||||
|
||||
option && myChart.setOption(option);
|
||||
// 设置图表
|
||||
const initCharts = () =>
|
||||
{
|
||||
const chartDom = document.getElementById( "chartWrapper" );
|
||||
const myChart = echarts.init( chartDom as HTMLDivElement );
|
||||
const option = {
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二",],
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
data: [200, 400, 600, 800, 1000,],
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: props.chartData,
|
||||
type: "line",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
window.onresize = function ()
|
||||
{
|
||||
// 自适应大小
|
||||
myChart.resize();
|
||||
};
|
||||
};
|
||||
option && myChart.setOption( option );
|
||||
|
||||
onMounted(() =>
|
||||
{
|
||||
initCharts();
|
||||
});
|
||||
window.onresize = function ()
|
||||
{
|
||||
// 自适应大小
|
||||
myChart.resize();
|
||||
};
|
||||
};
|
||||
|
||||
return { ui, initCharts, };
|
||||
},
|
||||
onMounted( () =>
|
||||
{
|
||||
initCharts();
|
||||
} );
|
||||
|
||||
console.log( props );
|
||||
|
||||
return { ui, initCharts, props, };
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user