Commit 7de49f76 by zhuxiaomei

蓝牙打印js 控制台输出js 单选选择器

parent eab03953
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
</head> </head>
<body> <body>
<!--<script src="<%= BASE_URL %>js/vconsole.min.js"></script>-->
<!--<script>-->
<!--window.vConsole = new window.VConsole();-->
<!--console.log('Hello world');-->
<!--</script>-->
<!--<noscript>--> <!--<noscript>-->
<!--<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.--> <!--<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.-->
<!--Please enable it to continue.</strong>--> <!--Please enable it to continue.</strong>-->
......
...@@ -23,12 +23,15 @@ ...@@ -23,12 +23,15 @@
</template> </template>
<script> <script>
/**
* 单选
*/
export default { export default {
props: { props: {
label: String, label: String,
value: {type: String, default: ''}, //默认值 value: {type: String, default: ''}, //默认值
columns: Array, columns: Array,
showKey: {type: String, default: ''} showKey: {type: String, default: ''} //用于展示的字段
}, },
data() { data() {
return { return {
......
...@@ -63,5 +63,47 @@ export default { ...@@ -63,5 +63,47 @@ export default {
* @type * @type
*/ */
Vue.prototype.$global = global Vue.prototype.$global = global
/**
* 按字节截取字符串
* @param str 字符串
* @param len 要截取的长度
*/
Vue.prototype.$subStringByBytes= function(str, len) {
if((!str && typeof(str) != 'undefined')) {
return '';
}
var num = 0;
var string = '';
for(var i = 0, lens = str.length; i < lens; i++) {
num += ((str.charCodeAt(i) > 255) ? 2 : 1);
if(num > len) {
break;
} else {
string = str.substring(0, i + 1);
}
}
return string;
}
/**
* 获取字符串的字节长度
* @param val 字符串
*/
Vue.prototype.$getLengthByBytes= function(val) {
var str = new String(val);
var bytesCount = 0;
for (var i = 0 ,n = str.length; i < n; i++) {
var c = str.charCodeAt(i);
if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) {
bytesCount += 1;
} else {
bytesCount += 2;
}
}
return bytesCount;
}
}, },
} }
...@@ -13,6 +13,15 @@ import MineRoutes from './mine-routes' ...@@ -13,6 +13,15 @@ import MineRoutes from './mine-routes'
import DebugComponent from '@/components/DebugComponent.vue' import DebugComponent from '@/components/DebugComponent.vue'
/**
* meta {
* title:标题
* leftArrow:是否显示返回按钮
* hideNavBar:是否隐藏标题栏 用于不需要显示标题栏的页面和自定义标题栏的页面,自定义标题详见:src/page/sampling-list/SamplingList.vue
* customerNavBarTitle:自定义标题
* }
*/
export default [ export default [
{ {
path: '/', component: Index, redirect: '/home', children: [ path: '/', component: Index, redirect: '/home', children: [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment