Git Product home page Git Product logo

vue-preview's People

Contributors

ls1231 avatar rap2hpoutre avatar wlykan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-preview's Issues

全局配置 w h

    list: [{
      src: 'https://placekitten.com/600/400',
      w: 600,
      h: 400
    }, {
      src: 'https://placekitten.com/1200/900',
      w: 1200,
      h: 900
    }]

一般从网络获取图片数据源,不带 w h,删掉 w,h 又报错。是否能够全局配置?

引入这个文件 run build 报错,大佬怎么解决

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: webpack --progress --hide-modules --config build/webpack.prod.config.js
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2018-03-08T01_08_24_927Z-debug.log

$preview.open报错

请问部署好之后发现报这个错误
Vue warn]: Property or method "$preview" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.
还有这个错误
index.js:50301 Uncaught TypeError: Cannot read property 'open' of undefined

然后原代码使用是
vue:
import VuePreview from 'vue-preview';
components: {
VuePreview
}

template:

数据格式也当正常,就是还多一个字段 type:img,

感觉是不支持$preview.open()这种写法,请问是什么原因

版本1.0.5,:src必须是“src”,否则点看图片出不来,缩略图能出来

template那里,只能这样:
<img class="preview-img" v-for="(item, index) in list" :src="item.src" height="100" @click="$preview.open(index, list)">
不能这样:
<img class="preview-img" v-for="(item, index) in list" :src="item.picSrc" height="100" @click="$preview.open(index, list)">

数据定义:
list: [{
src: 'https://placekitten.com/600/400', //不能是picSrc
w: 600,
h: 400
}, {
src: 'https://placekitten.com/1200/900',
w: 1200,
h: 900
}]

Thumbnail

I think it could be great if one can add thumbnail (instead of loading the whole images)

关于引用Unexpected token import

请教下那啥我用的 vue-cli 引用其他的模块用的import 都没问题,import vue-preview 就会显示 unexpected token import

photoswipe无法安装

➜ vue-preview git:(master) ✗ npm install photoswipe --save
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node/7.3.0/bin/node" "/usr/local/bin/npm" "install" "photoswipe" "--save"
npm ERR! node v7.3.0
npm ERR! npm v4.0.5

npm ERR! Maximum call stack size exceeded
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /Users/admin/Documents/vuex/vue-preview/npm-debug.log
➜ vue-preview git:(master) ✗ ll

Translate the readme in english

Actually, I can not read the readme. Readme on Github are often in english, it has a larger impact (i'm not english anyway, but I can read english). Do you think it could be translated?

Vue2.0 SyntaxError: Unexpected keyword 'import'

在Vue2.0下出现
SyntaxError: Unexpected keyword 'import'

我的所有代码
app.vue

<template>
  <div id="app">
    <transition name="fade" mode="out-in">
      <keep-alive>
        <router-view></router-view>
      </keep-alive>
    </transition>
  </div>
</template>

main.js

import Vue from 'vue'
import App from './App'
import MintUI from 'mint-ui';
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import Fastclick from 'fastclick';
import 'mint-ui/lib/style.css';


Fastclick.attach(document.body);

Vue.use(VueRouter)
Vue.use(VueResource)
Vue.use(MintUI);

import VuePreview from 'vue-preview'
Vue.use(VuePreview)

const Index = resolve => require(['./views/index'], resolve)

const router = new VueRouter({
  base: __dirname,
  routes: [{
    path: '/',
    name: 'root',
    component: Index
  }]
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

// 路由钩子
let indexScrollTop = 0;
router.beforeEach((to, from, next) => {
  if (from.name == 'root') {
    indexScrollTop = document.body.scrollTop;
    window.sessionStorage.scrollTop = indexScrollTop;
  }
  next();
});
router.afterEach((to, from) => {});

index.vue

<template>
  <div>
    <img class="preview-img" v-for="(item, index) in list" :src="item.src" height="100" @click="$preview.open(index, list)">
  </div>
</template>
<script>
export default {
  data() {
    return {
      list: [{
        src: 'https://placekitten.com/600/400',
        w: 600,
        h: 400
      }, {
        src: 'https://placekitten.com/1200/900',
        w: 1200,
        h: 900
      }]
    }
  }
}
</script>

旋转角度

之前版本还看见有图片旋转功能,新版本为什么没了

preview.vue文件中引用的css文件路径报错

引用方式

@import '~photoswipe/dist/photoswipe.css';
@import '~photoswipe/dist/default-skin/default-skin.css';

出错信息如下

Unknown error from PostCSS plugin. Your current PostCSS version is 6.0.11, but postcss-partial-import uses 5.2.17. Perhaps this is the source of
 the error below.
Error: Failed to find '~photoswipe/dist/photoswipe.css'
    in [
        /Users/haiyang/Documents/workspace/rry/case-report-web/node_modules/vue-preview/src/plugins/preview
    ]
    at /Users/haiyang/Documents/workspace/rry/case-report-web/node_modules/postcss-import/lib/resolve-id.js:48:11
    at <anonymous>
 ERROR  Failed to compile with 1 errors                                                                                                 12:41:55

 error  in ./node_modules/vue-preview/src/plugins/preview/preview.vue

Module build failed: Error: Failed to find '~photoswipe/dist/photoswipe.css'
    in [
        /Users/haiyang/Documents/workspace/rry/case-report-web/node_modules/vue-preview/src/plugins/preview
    ]
    at /Users/haiyang/Documents/workspace/rry/case-report-web/node_modules/postcss-import/lib/resolve-id.js:48:11
    at <anonymous>

 @ ./node_modules/vue-style-loader!./node_modules/css-loader?sourceMap!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-66e
7134e","scoped":false,"hasInlineConfig":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./node_modules/vue-preview/src/plug
ins/preview/preview.vue 4:14-277 13:3-17:5 14:22-285
 @ ./node_modules/vue-preview/src/plugins/preview/preview.vue
 @ ./node_modules/vue-preview/src/plugins/preview/index.js
 @ ./src/module/case/main.js
 @ multi ./build/dev-client ./src/module/case/main.js

是不是可以将两个css文件,放到js文件去请求呢?
我在...preview/index.js中请求正常

import PreviewComponent from './preview.vue'
import 'photoswipe/dist/photoswipe.css';
import 'photoswipe/dist/default-skin/default-skin.css';

按照readme进行插件引入会提示Unknown custom element: <vue-preview>

// main.js
import VuePreview from 'vue-preview'
Vue.use(VuePreview)
// a.vue
  <vue-preview :slides="slide1" @close="handleClose"></vue-preview>

提示:
Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.

请问这个使用了.use后需要手动.component进行注册吗?
望赐教

图片预览不显示

打开图片预览可以显示1,2,3,但是图片不出来,请问是什么原因

调用事件报错

<img class="preview-img" v-for="(item, index) in pics2" :src="item.src" height="100" @click="vm.$preview.open(index, pics2)">请问是这样调用,还是 <img class="preview-img" v-for="(item, index) in pics2" :src="item.src" height="100" @click="$preview.open(index, pics2)">这样调用的,你说的是组件实例不大明白

图片预览弹出后,浏览器直接返回上一页报错

preview.vue?4fb2:107 Uncaught TypeError: Cannot read property 'getBoundingClientRect' of undefined
at Object.getThumbBoundsFn (preview.vue?4fb2:107)
at _showOrHide (photoswipe.js?84b8:2536)
at PhotoSwipe.close (photoswipe.js?84b8:993)
at HTMLDivElement.PhotoSwipeUI_Default.ui.onGlobalTap (photoswipe-ui-default.js?7f39:759)
at _dispatchTapEvent (photoswipe.js?84b8:3208)
at eval (photoswipe.js?84b8:3260)

这个插件怎么让图片自适应?

我想要一个类似于微博里面点击放大图片的效果,那个预览时的大图高是自适应的,不用自己设置的,怎么弄?还有这插件支持rem单位吗?

build 报错

ERROR in static/js/vendor.f73f2120f658fae51edb.js from UglifyJs
Unexpected token: name ($vm) [./~/.1.0.5@vue-preview/src/plugins/preview/index.js:2,0][static/js/vendor.f73f2120f658fae51edb.js:25187,4]

怎么单击文字出现图片预览呢,

{{item2.filename}}
我用这样写是可以点击文件实现预览的,但是点击之后滑动到其他图片就没法关闭了。因为open里的第一个参数默认为0的原因的,该怎么解决呢

webpack打包出现出错

Module not found: Error: Cannot resolve 'file' or 'directory' ./default-skin.png in /node_modules/vue-preview/src/plugins/preview

引入url-loader后也不行

预览时的路由问题

请问下预览后地址栏会在后面加上路由,是怎么实现的,https://ls1231.github.io/vue-preview/#&gid=1&pid=1,就是#&gid=1&pid=1是点击后才会加上去的。

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.