vue项目中实现价格被横线划掉,折扣价效果

效果图

在这里插入图片描述

代码

横线划掉效果就是用到了css的一句代码:text-decoration: line-through;
其他颜色大小是自己改的。

<p class="usa">499.00
            <span
              style="
                text-decoration: line-through;
                font-size: 12px;
                color: #ccc;
              "
              >799</span
            >
          </p>
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
要在Vue项目使用Echarts和Vue-Awesome-Swiper,你需要先安装它们。你可以使用npm或者yarn安装它们: ``` npm install echarts vue-awesome-swiper ``` 或者 ``` yarn add echarts vue-awesome-swiper ``` 接下来,你需要在Vue组件导入并使用它们。下面是一个例子: ```html <template> <div> <swiper :options="swiperOptions"> <swiper-slide> <div ref="chart1" class="chart"></div> </swiper-slide> <swiper-slide> <div ref="chart2" class="chart"></div> </swiper-slide> <swiper-slide> <div ref="chart3" class="chart"></div> </swiper-slide> </swiper> </div> </template> <script> import Swiper from 'vue-awesome-swiper'; import 'swiper/dist/css/swiper.css'; import echarts from 'echarts'; export default { components: { Swiper, }, data() { return { swiperOptions: { loop: true, }, }; }, mounted() { this.renderChart(this.$refs.chart1, 'chart1'); this.renderChart(this.$refs.chart2, 'chart2'); this.renderChart(this.$refs.chart3, 'chart3'); }, methods: { renderChart(container, chartId) { const chart = echarts.init(container); chart.setOption(this.getChartOption(chartId)); }, getChartOption(chartId) { // 这里根据不同的chartId生成不同的Echarts配置 // 省略具体实现代码 }, }, }; </script> ``` 这里我们使用了Vue-Awesome-Swiper来实现轮播图,每个swiper-slide里面都包含了一个Echarts图表。在mounted函数,我们通过ref获取每个chart的DOM元素,并使用Echarts渲染图表。你可以根据自己的需求修改getChartOption函数,生成不同的Echarts配置。 注意:你需要在组件引入Echarts和Vue-Awesome-Swiper,并且在样式引入Swiper的CSS文件。如果你使用了Vue CLI创建项目,可以在main.js全局引入echarts和swiper.css: ```javascript import Vue from 'vue'; import App from './App.vue'; import echarts from 'echarts'; import 'swiper/dist/css/swiper.css'; Vue.prototype.$echarts = echarts; new Vue({ render: (h) => h(App), }).$mount('#app'); ``` 这样,在整个应用都可以使用echarts和swiper了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

接口写好了吗

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值