Code Monkey home page Code Monkey logo

mpvue-zanui's Introduction

mpvue-zanui

使用 mpvue 重写 zanui-weapp,实现了其中所有组件。

Vant Weapp 是基于有赞 Zanui 组件库进行的品牌升级,对于仍在使用 Zanui 的用户,建议逐渐使用 Vant Weapp 替换原有的组件。

Zanui 后续会进入维护状态,仓库地址为:https://github.com/youzan/zanui-weapp
Vant 在 mpvue 的使用方法可参照 https://github.com/Rychou/mpvue-vant

使用方法

运行小程序 demo

1. git clone
git clone https://github.com/samwang1027/mpvue-zanui.git

2. 安装依赖
cd mpvue-zanui && npm install

3. 启动程序
npm run dev

4. 预览
打开微信开发者工具,新建项目,将目录指向 /dist 即可

引用组件

  1. 安装 npm 包
npm install mpvue-zanui
  1. App.vue 内通过 @import '~mpvue-zanui/src/assets/style/zanui.wxss'; 的方式导入zanui样式

3. 调用方式在 node_modules/mpvue-zanui/index.js 中,如 import {TopTips} from 'mpvue-zanui'

  1. 由于需要等待 mpvue-loader 升级重构,暂时仅能直接引用 import TopTips from 'mpvue-zanui/src/components/zan/toptips'

  2. 组件的详细使用方式通过阅读源码理解

Bug

  • Field 输入框界面中,带圆角输入框因为 css 问题,placeholder 无法靠右

todo

  • props 属性使用对象包装
  • props 中不注入 function,用 $emit 替换
  • CSS 全局引用改为分块引用

mpvue-zanui's People

Contributors

armyja avatar git9527 avatar lgb531 avatar ltinyho 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  avatar

mpvue-zanui's Issues

为什么 import { TopTips } from 'mpvue-zanui' 不起作用?

  <view class="container">
    <view class="doc-title zan-hairline--bottom">TOPTIPS</view>
    <view class="zan-btns" style="margin-top: 30vh;">
      <button class="zan-btn" @click="showTopTips">
        显示toptips
      </button>
    </view>
    <toptips />
  </view>
  import { TopTips, getComponentByTag, extractComponentId } from 'mpvue-zanui';
  export default {
    components: {
      toptips: TopTips
    },
    data () {
      return {
        TopTips: {}
      }
    },
    methods: {
      showTopTips () {
        getComponentByTag(this, 'toptips').showZanTopTips('toptips的内容')
      }
    }
  }

npm run dev 报错没绑定event?

➜ mpvue-zanui git:(master) ✗ npm run dev

[email protected] dev /Users/wangjun/code/github/wechat/mpvue-zanui
node build/dev-server.js

events.js:183
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE 127.0.0.1:8080
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1367:14)
at listenInCluster (net.js:1408:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1517:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: node build/dev-server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev 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! /Users/wangjun/.npm/_logs/2018-08-09T06_59_18_806Z-debug.log
Uploading image.png…

nom run dev 报错

events.js:165
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE 127.0.0.1:8080
at Server.setupListenHandle [as _listen2] (net.js:1346:14)
at listenInCluster (net.js:1387:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1502:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:72:10)
Emitted 'error' event at:
at emitErrorNT (net.js:1366:8)
at process._tickCallback (internal/process/next_tick.js:178:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: node build/dev-server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev 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! /Users/wuweichang/.npm/_logs/2018-04-23T13_32_53_372Z-debug.log

npm包 stepper组件有BUG

<input
class="zan-stepper__text"
:class="{ 'zan-stepper--disabled' : min >= max }"
type="number"
data-component-id="componentId"
:data-min="min"
:data-max="max"
:value="stepper"
:disabled="min >= max"
@blur="_handleZanStepperBlur"
/>
data-component-id没有动态绑定

下载下来执行npm run dev报错,求助!!!

events.js:183
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE 127.0.0.1:8080
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1501:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: node build/dev-server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev 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! E:\nodeJs\node_cache_logs\2018-07-27T02_45_12_315Z-debug.log

npm run build报错

ERROR in static/js/vendor.js from UglifyJs
Invalid assignment [./~/mpvue-zanui/src/utils/helper.js:3,0][static/js/vendor.js:7656,40]

Build failed with errors.

zanui.wxss移动了位置

node_modules/mpvue-zanui/src/assets/zanui.wxss 已经移到了 node_modules/mpvue-zanui/src/assets/style/zanui.wxss。踩到了坑。麻烦改下MarkDown

打包出来,微信小程序必要文件app.js/app.json/app.wxss等缺失

$ node -v //8.9.0
$ npm -v //5.6.0
npm run dev会报warning: No parser and no filepath given, using 'babylon' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.
最后编译是成功的
Starting to optimize CSS... DONE Compiled successfully in 6515ms15:15:59
然而dist里面却只有components/pages/static三个文件夹,微信小程序要用的app.js/app.json/app.wxss等都没有
同样的环境跑mpvue-weui是可以的,这里问题出在了哪里?

关于 import 的问题

image

  // import { Switch as ZanSwitch } from 'mpvue-zanui'  
  import ZanSwitch from 'mpvue-zanui/src/components/zan/switch'
  export default {
    components: {
      ZanSwitch
    },

使用 import { Switch as ZanSwitch } from 'mpvue-zanui' 会如上图所示报错,使用下面那样 import 就正常了,求解

真机调试,操作反馈模块报错

在真机上开启调试,出现vConsole后,下面的操作反馈模块的组件大多会报错:
thirdScriptError
Converting circular structure to JSON

不开启调试状态的时候没有问题。

zan-field组件没有 disabled 功能

版本: "^1.0.3"
在 zan-field 组件加上 disabled, 依然能进行输入, 查看 field的源代码 发现并没有 disabled 或者 onlyread 的props

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.