airyland / vux

Mobile UI Components based on Vue & WeUI
https://vux.li
MIT License
17.59k stars 3.71k forks source link

历经千辛万苦,但是还是没入门 #353

Closed zhonggedan closed 8 years ago

zhonggedan commented 8 years ago

npm:3.10.3 vux:npm install vux 直接安装的 我想用tabbar,然后在app.vue里面这样写:

<template>
  <div id="app">
    <div>
      <tabbar>
        <tabbaritem>
          <img slot="icon" src="https://o84lhz5xo.qnssl.com/master/src/assets/demo/icon_nav_button.png">
          <span slot="label">Wechat</span>
        </tabbaritem>
        <tabbaritem show-dot>
          <img slot="icon" src="https://o84lhz5xo.qnssl.com/master/src/assets/demo/icon_nav_msg.png">
          <span slot="label">Message</span>
        </tabbaritem>
        <tabbaritem selected>
          <img slot="icon" src="https://o84lhz5xo.qnssl.com/master/src/assets/demo/icon_nav_article.png">
          <span slot="label">Explore</span>
        </tabbaritem>
        <tabbaritem>
          <img slot="icon" src="https://o84lhz5xo.qnssl.com/master/src/assets/demo/icon_nav_cell.png">
          <span slot="label">News</span>
        </tabbaritem>
      </tabbar>
    </div>
  </div>
</template>
<script>
import tabbar from 'vux/src/components/tabbar'
import tabbaritem from 'vux/src/components/tabbar-item'
export default {
  components: {
    tabbar,
    tabbaritem
  }
}
</script>

但是,没有达到目的,报错如下:

`webpack: bundle is now VALID. webpack: bundle is now INVALID. webpack building... webpack built 476f2d4b6c6c7287a1b9 in 750ms Hash: 476f2d4b6c6c7287a1b9 Version: webpack 1.13.1 Time: 750ms Asset Size Chunks Chunk Names app.js 1.19 MB 0 app

ERROR in ./~/babel-loader?presets[]=es2015&plugins[]=transform-runtime&comments=false!./~/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue Module not found: Error: Cannot resolve module 'vux/src/components/tabbar-item' in E:\space_ws\ssp\src @ ./~/babel-loader?presets[]=es2015&plugins[]=transform-runtime&comments=false!./~/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue 11:18-59 Child html-webpack-plugin for "index.html": Asset Size Chunks Chunk Names index.html 21.4 kB 0 webpack: bundle is now VALID.`

airyland commented 8 years ago

tabbar是一个组合组件,入口包含wrapper和item两个组件。

import { Tabbar, TabbarItem } from 'vux/src/components/tabbar'

见源码这里:https://github.com/airyland/vux/blob/master/src/components/tabbar/index.js

zhonggedan commented 8 years ago

成功解决