vue2

跨域设置

axios.defaults.baseURL = 'http://192.168.1.118:808';
axios.defaults.withCredentials = true;
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

http://www.ituring.com.cn/article/200275

.withCredentials()方法可以激活发送原始cookie的能力,不过只有在Access-Control-Allow-Origin不是一个通配符(*),并且Access-Control-Allow-Credentials为’true’的情况下才行.

打包

http://m.blog.csdn.net/article/details?id=51322637

npm adduser

如果长时间不登录,可能会过期,使用 npm login 进行登录就可以 publish 了。

npm publish

 

如果使用淘宝的源(http://cnodejs.org/topic/4f9904f9407edba21468f31e),则不能使用 npm publish。 需要切回 npmjs 源: 

npm config set registry http://registry.npmjs.org/

 

Element-ui修改

1. 下载源码:https://github.com/ElemeFE/element

2. 参考说明:https://github.com/ElemeFE/element/blob/master/.github/CONTRIBUTING.zh-CN.md

3. fock

4. git pull

5. commit & push

发布自己的Vue库

以 element-ui 为基础,提交源码之后,不能马上就加入新功能。 把 element-ui 下载一份, 全局替换: element-ui  => element-ui-yxh

1. npm install

2. 修改源码,修改版本号,递增

3. npm build dist

4. npm adduser

5. npm publish

Promise.reject错误捕获

http://www.uedsc.com/296729.html

 

Vue2拦截器

vue2自带的拦截器,已被 axios 替代: https://github.com/mzabriskie/axios

复制代码
try {
  Vue.http.interceptors.push(function (request, next) {
    // ...
    // 请求发送前的处理逻辑
    // ...

    var getFullUrl = function (url) {
      if (url.slice(0, 2) == "//") return url;

      if (url[0] != "/") {
        url = "/" + url;
      }
      return "//172.30.8.132:808" + url;
    }

    // request.method = "JSONP";
    request.url = getFullUrl(request.url);

    next(function (response) {
      if (response.status == 200) {
        if (response.body && response.body.msg) {
          this.$message.error(response.body.msg);
          return new Promise(function (resolve, reject) {
            reject(response);
          });
        }
      }
      else if (response.status == 500) {
        this.$message.error(response.body);
        // throw new Error("Error");
        return new Promise(function (resolve, reject) {
          reject(response);
        });
      }
      return;
    })
  });
} catch (e) {
  //console.info("Vue.http.interceptors:" + e.message);
}
复制代码

 

 

问题

重置数据

Object.assign(this.$data,this.$options.data());

如何在运行时设置 v-model 的表达式 ?

复制代码
html:

<input  ref="name" />

 

//js:像这样:

this.info.name = "OK"

this.$refs["name"].$propData["value"].express = "info.name";
复制代码

 

获取 v-modle 表达式:

var d = VueComponent;

d.$vnode.data.model.expression

 

调试

https://www.zhihu.com/question/41127712/answer/252388995

devtool: '#eval-source-map'

jsx

http://blog.csdn.net/u014628388/article/details/76099812

 

版本

npm 组件版本真是害人啊。

https://majing.io/posts/10000022041170

No parser and no file path given, couldn't infer a parser.

升级 vue-loader 到 14.2.3+

 

IE11 , Symbol 未定义的错误: 

https://www.cnblogs.com/sophie_wang/p/7879918.html

安装:  es6-symbol

 

posted @   NewSea  阅读(361)  评论(0编辑  收藏  举报
编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端
历史上的今天:
2012-04-05 IE8下报的找不到 jQuery 方法的排查。
点击右上角即可分享
微信分享提示