Coder Social home page Coder Social logo

Comments (8)

bluefox1688 avatar bluefox1688 commented on July 17, 2024

贴些代码或者错误截图来看看

from vue-cli-multi-page.

Leopold1988 avatar Leopold1988 commented on July 17, 2024

image

<div class="flex-demo">
          <img src="1.jpg">
          <img src="2.jpg">
          <img src="3.jpg">
        </div>

from vue-cli-multi-page.

Leopold1988 avatar Leopold1988 commented on July 17, 2024

还一个我用了vux2的swiper,build了之后,图片也没有在在dist/static下面,看了下swiper使用的是background,如下如:
image

<template>
  <div id="indexmain">
    <swiper loop auto :list="swiperlist" :index="swiperindex" @on-index-change="indexChange"></swiper>
    <flexbox>
      <flexbox-item>
        <div class="flex-demo">
          
        </div>
      </flexbox-item>
      <flexbox-item><div class="flex-demo">2</div></flexbox-item>
      <flexbox-item><div class="flex-demo">3</div></flexbox-item>
      <flexbox-item><div class="flex-demo">4</div></flexbox-item>
    </flexbox>
    <tabbar>
      <tabbar-item>
        <img 
          slot="icon" 
          src="../../../assets/demo/icon_nav_button.png">
        <span slot="label">Wechat</span>
      </tabbar-item>
      <tabbar-item show-dot>
        <img 
          slot="icon" 
          src="../../../assets/demo/icon_nav_msg.png">
        <span slot="label">Message</span>
      </tabbar-item>
      <tabbar-item selected link="/component/demo">
        <img 
          slot="icon" 
          src="../../../assets/demo/icon_nav_article.png">
        <span slot="label">Explore</span>
      </tabbar-item>
      <tabbar-item badge="2">
        <img 
          slot="icon" 
          src="../../../assets/demo/icon_nav_cell.png">
        <span slot="label">News</span>
      </tabbar-item>
    </tabbar>
  </div>
</template>

<script>
import Lib from 'assets/js/Lib';
import { Tabbar, TabbarItem, Swiper, Flexbox, FlexboxItem } from 'vux'

const baseList = [{
  url: 'javascript:',
  img: '../../static/img/1.jpg',
  title: '送你一朵fua'
}, {
  url: 'javascript:',
  img: '../../static/img/2.jpg',
  title: '送你一辆车'
}, {
  url: 'javascript:',
  img: '../../static/img/3.jpg',
  title: '送你一次旅行'
}]

const urlList = baseList.map((item, index) => ({
  url: 'http://m.baidu.com',
  img: item.img,
  title: `(可点击)${item.title}`
}))

export default {
  components: {
    Tabbar,
    TabbarItem,
    Swiper,
    Flexbox,
    FlexboxItem
  },
  data () {
    return {
      swiperlist: urlList,
      swiperindex: 0
    }
  },
  methods: {
    indexChange (index) {
      this.swiperindex = index
    }
  }
}
</script>

<style lang="less" scoped>
.flex-demo {
  text-align: center;
  color: #fff;
  background-color: #20b907;
  border-radius: 50%;
  background-clip: padding-box;
}
</style>

from vue-cli-multi-page.

mackxu avatar mackxu commented on July 17, 2024

@bluefox1688

提供的例子中,引用iconfont的css是在static/css/vendor.css, 正好对上font目录。代码如下:
font-family:iconfont;src:url(../../static/fonts/iconfont.eot)

但是如果引用iconfont的css是static/css/views/home/list.css。图片路径就出问题了。

如果说的不对,望指正

from vue-cli-multi-page.

634323580 avatar 634323580 commented on July 17, 2024

@Leopold1988 请问解决了吗,我也遇到这个问题,css引用背景图片路径错误

from vue-cli-multi-page.

mackxu avatar mackxu commented on July 17, 2024

@634323580 有一种解决办法,打包资源时用绝对路径:在webpack里添加publicPath

from vue-cli-multi-page.

634323580 avatar 634323580 commented on July 17, 2024

@mackxu 再请问一个问题,打包后的图片怎么才能做到每个页面图片单独放一个文件夹

from vue-cli-multi-page.

zuishuanglin avatar zuishuanglin commented on July 17, 2024

@634323580 他的例子就是单独的一个assets的文件夹,但是我里面的图片就是build不出来,只有dome的那个一直存在

from vue-cli-multi-page.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.