唐植超

唐植超 查看完整档案

填写现居城市  |  填写毕业院校  |  填写所在公司/组织填写个人主网站
编辑
_ | |__ _ _ __ _ | '_ \| | | |/ _` | | |_) | |_| | (_| | |_.__/ \__,_|\__, | |___/ 个人简介什么都没有

个人动态

唐植超 提出了问题 · 2019-01-22

flutter 自定义控件不能放输入框

本人初学flutter ,今天要自定义一个输入框控件,结果遇到一个奇怪的问题,自定义的空间框里,不能放入输入框,放入就报错,代码如下,是不是哪里冲突里?

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class SearchTextInput extends StatelessWidget {
@override
Widget build(BuildContext context) {

// TODO: implement build
return Container(
  height: 20,
  decoration:
      BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(5))),
  child: Row(
    mainAxisSize: MainAxisSize.max,
    mainAxisAlignment: MainAxisAlignment.center,
    crossAxisAlignment: CrossAxisAlignment.center,
    children: <Widget>[
      Container(
        decoration: BoxDecoration(
            border:
                Border(right: BorderSide(color: Colors.black, width: 1))),
        child: Row(
          children: <Widget>[Text("北京"), Icon(Icons.arrow_drop_down)],
        ),
      ),
      Padding(
        padding: EdgeInsets.only(
          left: 5,
        ),

// child: Text("---sssssssssssssssssssssssssssss"), //这行代码可以

        child: TextField( ), //这行代码不行
      ),
    ],
  ),
);

}
}

直接只放一个输入框,没有问题,一旦放了布局控件,就报错,错误内容:

Performing hot reload...
Syncing files to device Android SDK built for x86...
I/flutter (15752): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (15752): The following assertion was thrown during performLayout():
I/flutter (15752): BoxConstraints forces an infinite width.
I/flutter (15752): These invalid constraints were provided to RenderRepaintBoundary's layout() function by the
I/flutter (15752): following function, which probably computed the invalid constraints in question:
I/flutter (15752): _RenderDecoration._layout.layoutLineBox (package:flutter/src/material/input_decorator.dart:815:11)
I/flutter (15752): The offending constraints were:
I/flutter (15752): BoxConstraints(w=Infinity, 0.0<=h<=120.0)

环境: window 10 家庭版,
代码位置: https://github.com/alvin19876...

希望有大神指点一下

关注 3 回答 2

唐植超 提出了问题 · 2018-12-04

如何修改 package.json 的name version

目前在写一个项目生成工具,前端 用的vue的nodejs 项目。
我生成的项目其他的问题都没有,但是package.json 里面的 name 和version 是根据当时的项目动态生成的,
结果发现动态生成的 name ,version 修改后 npm install 无法执行,报错:

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN Invalid version: "1.0"
npm WARN webapp No description
npm WARN webapp No repository field.
npm WARN webapp No README data
npm WARN webapp No license field.

不改名字,不改版本是可以的,求大神指点一二

{
"name": "test",
"version": "1.0",
"private": true
}

关注 3 回答 1

唐植超 关注了用户 · 2018-12-04

ningyb @ningyb

关注 1

唐植超 回答了问题 · 2018-11-29

JS的刻度尺如何写?

关注 7 回答 5

唐植超 回答了问题 · 2018-04-20

Vue路由拦截

router.beforeEach((to, from, next) => {


next(); //前往下一个页面

})

router.afterEach(transition => {

});

关注 8 回答 8

唐植超 提出了问题 · 2018-04-20

ant-design-mobile 自定义主题 博安错

已经完成了一个 ant-design-mobile 的h5 项目,不涉及rn
自定义主题的时候,按照官方文档报错:

[start ]
[start ] Failed to compile.
[start ]
[start ] ./src/theme.less
[start ] Module build failed:
[start ]
[start ] height: @icon-size-xxs;
[start ] .encoded-svg-background('right');
[start ] ^
[start ] Inline JavaScript is not enabled. Is it set in your options?
[start ] in E:2017-new-workspacedl-keep-cloudsourcesdl-keep-cloudapp-centersrcmainwebappnode_modulesantd-mobilelibaccordionstyleindex.less (line 36, column 8)
[start ]

官方的两种方式都使过了,一样的,所以只能请大神出来帮我一把了
项目中使用了dva 框架,package.json 如下

"dependencies": {

"@antv/f2": "^3.1.3-beta.2",
"antd-mobile": "^2.1.8",
"babel-runtime": "^6.9.2",
"dva": "^1.2.1",
"font-awesome": "^4.7.0",
"js-cookie": "^2.2.0",
"moment": "^2.22.0",
"rc-form": "^2.1.7",
"react": "^15.4.0",
"react-dom": "^15.4.0",
"reqwest": "^2.0.5"

},
"devDependencies": {

"babel-eslint": "^7.1.1",
"babel-plugin-dva-hmr": "^0.3.2",
"babel-plugin-import": "^1.7.0",
"babel-plugin-transform-runtime": "^6.9.0",
"css-loader": "^0.28.11",
"eslint": "^3.12.2",
"eslint-config-airbnb": "^13.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.8.0",
"expect": "^1.20.2",
"husky": "^0.12.0",
"less": "^3.0.1",
"less-loader": "^4.1.0",
"less-vars-to-js": "^1.2.1",
"mockjs": "^1.0.1-beta3",
"npm-run-all": "^4.1.2",
"postcss-pxtorem": "^4.0.1",
"redbox-react": "^1.4.3",
"roadhog": "^1.1.1",
"shelljs": "^0.8.1",
"style-loader": "^0.20.3"

}

关注 1 回答 0

唐植超 提出了问题 · 2018-02-22

vue2 + iview Rate (评分控件)如何改变icon

标题就是问题,试了好久,发现都不行,换成别的控件,风格上又非常不统一,希望有内行的人给个思路,

关注 3 回答 2

唐植超 提出了问题 · 2018-02-22

vue2 + iview Table 嵌入文本框失去交单

各位大神,用vue2 + iview 做一套界面,在table 中嵌入了Input
每次修改Input的值,都会失去焦点,多次调试以后,发现是修改了值以后,该了数据源,然后数据源就会重新把Table 加载一遍,得到的界面,已经不是原来的界面了,换成element ui 是没有这个问题的,
代码如下,希望大神能帮我想想办法

<link rel="stylesheet" type="text/css" href="iview.css">
<script type="text/javascript" data-original="vue.min.js"></script>
<script type="text/javascript" data-original="iview.min.js"></script>
<script type="text/javascript" data-original="axios.min.js"></script>
<div id="app">
    <div class="search">
        <i-input v-model="table_name" placeholder="请输入表名" style="width:200px"></i-input>
        <i-button @click="query" type="primary">查询</i-button>
        <i-button @click="createCode" type="primary">生成代码</i-button>
    </div>
    <i-table class="table" :columns="columns" :data="dataList" size="small" ref="selection"></i-table>
</div>
<script>
    axios.defaults.headers.post['Content-Type'] = 'application/json';
    new Vue({
        el: '#app',
        data: function () {
            const that = this;
            return {
                columns: [
                    {type: 'selection', align: 'center', width: '40'},
                    {title: '表名', key: 'table_name'},
                    {title: '注释', key: 'comments'},
                    {
                        title: '类名', key: 'class_name',
                        render: (h, params) => {
                            return h('i-input', {
                                props: {size: 'small', value: params.row.class_name},
                                on: {
                                    input: (value) => {
                                        that.dataList[params.index].class_name = value;
                                    }
                                }
                            });
                        }
                    },
                    {
                        title: '类中文名', key: 'cn_name',
                        render: (h, params) => {
                            return h('i-input', {
                                props: {size: 'small', value: params.row.cn_name},
                                on: {
                                    "on-change": (event) => {
                                        console.log(event);
                                         // params.row.cn_name = event.target.value; 这么写不能获得数据
                                           that.dataList[params.index].cn_name = event.target.value; //这么写就一定失去焦点
//                                     //    event.target.select();
                                    }
                                }
                            });
                        }
                    },
                ],
                dataList: [],
                table_name: null,
            };
        },
        created: function () {
            this.query();
        },
        methods: {
            query() {
                axios.post("/code/queryList", JSON.stringify({"table_name": this.table_name})).then(res => {
                    this.dataList = res.data;
                }).catch(res => {
                    this.$Message.error({content: '加载表信息败!' + res});
                });
            },
            createCode() {
                if (this.$refs.selection.getSelection().length == 0) {
                    this.$Message.warning({content: '请至少选择一条记录.'});
                    return;
                }
                axios.post("/code/create", JSON.stringify(this.$refs.selection.getSelection())).then(res => {
                    this.$Message.success({content: '生成代码成功.'});
                }).catch(res => {
                    this.$Message.error({content: '生成代码失败,请检查代码是否已经存在!' + res});
                });
            }
        }
    });
</script>
<style>
    #app {
        padding: 10px;
    }

    .search {
        padding-bottom: 10px;
    }
</style>

希望有大神帮忙解决一下

关注 1 回答 0

唐植超 关注了用户 · 2018-02-22

咚子 @zi_597d64ce14187

一个前端

关注 12542

唐植超 关注了用户 · 2018-02-22

李十三 @lishisan

知道的越多,不知道的越多。

青团社招聘:前端技术专家

简历发至邮箱:lishixuan@qtshe.com

关注 16682

认证与成就

  • 获得 4 次点赞
  • 获得 20 枚徽章 获得 1 枚金徽章, 获得 6 枚银徽章, 获得 13 枚铜徽章

擅长技能
编辑

(゚∀゚ )
暂时没有

开源项目 & 著作
编辑

(゚∀゚ )
暂时没有

注册于 2016-12-22
个人主页被 383 人浏览