(小程序)按钮切换对应展示区域
需求:点击按钮切换表格和图表两种展示方式
html
<u-button type="primary" size="mini" text="图表" v-if="form.curType === 'table'"
@click="showEcharts"></u-button>
<u-button type="primary" size="mini" text="表格" v-if="form.curType === 'echarts'"
@click="showTable"></u-button>
js
const form = ref({
curType: "table", // echarts
});
// 切换结果
const showTable = () => {
form.value.curType = "table";
};
const showEcharts = () => {
form.value.curType = "echarts";
};