weex 小結

1. import  文件時,必須引入全稱,不能省略 .vuejavascript

import mEcharts from '../components/Echarts.vue'

2.weex 的 cli 中沒有 配置 vue-router  和 less  須要本身安裝css

npm install vue-router --save
npm install less less-loader --save

3.安裝 node-sass 時,須要同時安裝 sass-loadervue

安裝 node-sassjava

npm install --save node-sass --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/dist --sass-binary-site=http://npm.taobao.org/mirrors/node-sass

安裝 sass-loadernode

npm install sass-loader --save

4.css樣式  不支持縮寫webpack

例如:web

border: 1px solid #eee;

須要改成:vue-router

border-width: 1px;
border-style: solid;
border-color: #eee;

5.圖片名稱 不能有 ' _ 'npm

例如:緩存

ic_tab_home_normal.png 或 01.png

須要改爲:

icTabHomeNormal.png

最後發現,須要 安裝 url-loader 插件

npm i url-loader -S

配置  webpack.dev.js

{
  test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  loader: 'url-loader'
}

6.[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

配置: webpack.config.js

resolve: {
    alias: {
	'vue': 'vue/dist/vue.js'
    }
}

7.<image></image> 沒法讀取本地圖片,官方解釋是 減少打包後的 apk 文件的體積,當用戶首次安裝後,會從網上將圖片緩存至本地。

正確用法:

<image class="input-img" src="http://192.168.1.208:8081/src/assets/img/user.png"></image>  

8.在 Weex 中,咱們只支持 px 長度單位。而且它將在 JavaScript 運行時和本機渲染器中解析爲數字類型。

.

相關文章
相關標籤/搜索