-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
请问可以支持 uni-app 吗 #116
Comments
理论上任何第三方的框架都是支持的呢。构建出来当成自定义组件使用即可。 |
uniapp 使用流程1、准备工作,安装必要工具(git/npm等)
7、将修改过的towxml文件夹复制到uniapp工程的static目录下
8.2 在需要使用towxml的页面添加
|
已加入到 wiki https://github.com/sbfkcel/towxml/wiki 感谢 @anyfar |
在uni中还支持绑定事件吗?我绑定了点击事件没效果 |
@jiangzhaoyong 不专门去主动支持这些第三方的框架。当然理论上来说,是可以支持的。可能需要自己稍加改造。欢迎改造完之后将经验 分享给大家。 |
我先把这个主题打开,看有没其它人有遇到类似的问题。 |
绑定点击事件没效果是由于,使用uni-app的话, 会导致注册和调用的两个global不一样. 所以最好在wxcomponents里面写个组件来引入towxml, 在组件中绑定事件 |
uniapp 怎么把解析结果绑定到页面标签上? 我绑定了不显示 |
我的也是 点击事件没用 |
uni-app 就只能在小程序里面用 |
官方暂时不考虑这些第三方框架,可自行移植。 |
你好现在打包生成的不再是vue文件,需要配置什么吗 |
使用uniapp时,微信小程序能使用很赞。 |
不能响应事件的问题,是因为 global 不正确,自己改一下就好,全局搜索 initObj = (obj,option)=>{
const result = {
theme:option.theme || 'light',
_e:{}
},
events = global._events = {},
base = option.base;
// 主题保存到全局
global._theme = result.theme;
// 事件添加到全局中,各个组件在触发事件时会从全局调用
if(option.events){
for(let key in option.events){
events[key] = option.events[key];
};
}; 改成 initObj = (obj,option)=>{
const globalData = getApp().globalData;
const result = {
theme:option.theme || 'light',
_e:{}
},
events = globalData._events = {},
base = option.base;
// 主题保存到全局
global._theme = result.theme;
// 事件添加到全局中,各个组件在触发事件时会从全局调用
if(option.events){
for(let key in option.events){
events[key] = option.events[key];
};
}; attached: function () {
const _ts = this;
config.events.forEach(item => {
_ts['_' + item] = function (...arg) {
if (global._events && typeof global._events[item] === 'function') {
global._events[item](...arg);
}
};
});
} 改成 attached: function () {
const _ts = this;
const globalData = getApp().globalData;
config.events.forEach(item => {
_ts['_' + item] = function (...arg) {
if (globalData._events && typeof globalData._events[item] === 'function') {
globalData._events[item](...arg);
}
};
});
} |
感谢
…------------------ 原始邮件 ------------------
发件人: ***@***.***>;
发送时间: 2021年11月17日(星期三) 中午12:05
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [sbfkcel/towxml] 请问可以支持 uni-app 吗 (#116)
不能响应事件的问题,是因为 global 不正确,自己改一下就好,全局搜索 global._events 替换一下
例如
initObj = (obj,option)=>{ const result = { theme:option.theme || 'light', _e:{} }, events = global._events = {}, base = option.base; // 主题保存到全局 global._theme = result.theme; // 事件添加到全局中,各个组件在触发事件时会从全局调用 if(option.events){ for(let key in option.events){ events[key] = option.events[key]; }; };
改成
initObj = (obj,option)=>{ const globalData = getApp().globalData; const result = { theme:option.theme || 'light', _e:{} }, events = globalData._events = {}, base = option.base; // 主题保存到全局 global._theme = result.theme; // 事件添加到全局中,各个组件在触发事件时会从全局调用 if(option.events){ for(let key in option.events){ events[key] = option.events[key]; }; };
attached: function () { const _ts = this; config.events.forEach(item => { _ts['_' + item] = function (...arg) { if (global._events && typeof global._events[item] === 'function') { global._events[item](...arg); } }; }); }
改成
attached: function () { const _ts = this; const globalData = getApp().globalData; config.events.forEach(item => { _ts['_' + item] = function (...arg) { if (globalData._events && typeof globalData._events[item] === 'function') { globalData._events[item](...arg); } }; }); }
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
作者大佬,如何使用hljs主题啊,不生效 |
请教一下 uniapp部分数学公式解析不出来咋解决呀 |
分享一下适用于 uniapp vue3 的适配: 保存到项目 /wxcomponents/towxml 下 目录下有 一个 htmltowxml 组件 ,可根据需要自行修改: 在需要使用的页面的 page.json 里配置使用 {
"path": "pages/xxx/xxx",
"style": {
"navigationBarTitleText": "xxx",
"enablePullDownRefresh": false,
"mp-weixin": {
"usingComponents": {
"htmltowxml": "/wxcomponents/towxml/htmltowxml"
}
}
} 使用: <htmltowxml :value="contentT" class="ql-editor" @click="onClick" /> export default {
data() {
return {
contentT: '<div style="text-align:center;"><img src="https://web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png"/></div>'
}
},
methods: {
onClick(e){
console.log(e)
}
},} .ql-editor {
padding: 0 !important;
} 以后有更新的话,只需要重复 上面大哥说的 再把 htmltowxml 组件放到里面即可。 |
module 'wxcomponents/towxml/parse/highlight/languages/c-like.js' is not defined, require args is './languages/c-like'
你好, 请问一下, 按这个流程做完出现这个错误,是什么原因?
|
微信开发者工具新版的bug,亲测回退版本可以解决 @zhanlangorz |
|
已收到!
|
uniapp vue2版本支持接入吗 |
已收到!
|
打包过后的towxml必须要放置在staic目录下吗,我尝试放在了pages文件下的一个文件夹当中,想要以分包的形式把towxml分出去减少主包体积,但是在页面当中import时提示找不到towxwml组件 |
放到了static下面也不行,请问解决了吗? |
已收到!
|
大佬, 跪拜感谢🙏 |
已收到!
|
在uniapp+ts环境下,怎么引入towxml? |
请问 类似的 Error: module 'wxcomponents/towxml/parse/highlight/languages/json.js' is not defined, require args is './languages/json' 回退到哪个版本的开发者工具可以 |
已收到!
|
uniapp 没有这种插件,作者考虑适配一下吗
The text was updated successfully, but these errors were encountered: